27 #define __STDC_FORMAT_MACROS 59 #if defined(ENABLE_SYSTEMTAP) 65 #if !defined(SERVER_MODE) 66 #define pthread_mutex_init(a, b) 67 #define pthread_mutex_destroy(a) 68 #define pthread_mutex_lock(a) 0 69 #define pthread_mutex_trylock(a) 0 70 #define pthread_mutex_unlock(a) 74 #define HEAP_BESTSPACE_SYNC_THRESHOLD (0.1f) 78 #define OR_FIXED_ATTRIBUTES_OFFSET_BY_OBJ(obj, nvars) \ 79 (OR_HEADER_SIZE(obj) + OR_VAR_TABLE_SIZE_INTERNAL(nvars, OR_GET_OFFSET_SIZE(obj))) 81 #define HEAP_GUESS_NUM_ATTRS_REFOIDS 100 82 #define HEAP_GUESS_NUM_INDEXED_ATTRS 100 84 #define HEAP_CLASSREPR_MAXCACHE 1024 86 #define HEAP_STATS_ENTRY_MHT_EST_SIZE 1000 87 #define HEAP_STATS_ENTRY_FREELIST_SIZE 1000 90 #define HEAP_DROP_FREE_SPACE (int)(DB_PAGESIZE * 0.3) 92 #define HEAP_DEBUG_SCANCACHE_INITPATTERN (12345) 94 #if defined(CUBRID_DEBUG) 95 #define HEAP_DEBUG_ISVALID_SCANRANGE(scan_range) \ 96 heap_scanrange_isvalid(scan_range) 98 #define HEAP_DEBUG_ISVALID_SCANRANGE(scan_range) (DISK_VALID) 101 #define HEAP_IS_PAGE_OF_OID(thread_p, pgptr, oid) \ 103 && pgbuf_get_volume_id (pgptr) == (oid)->volid \ 104 && pgbuf_get_page_id (pgptr) == (oid)->pageid) 106 #define MVCC_SET_DELETE_INFO(mvcc_delete_info_p, row_delete_id, \ 107 satisfies_del_result) \ 110 assert ((mvcc_delete_info_p) != NULL); \ 111 (mvcc_delete_info_p)->row_delid = (row_delete_id); \ 112 (mvcc_delete_info_p)->satisfies_delete_result = (satisfies_del_result); \ 116 #define HEAP_MVCC_SET_HEADER_MAXIMUM_SIZE(mvcc_rec_header_p) \ 119 if (!MVCC_IS_FLAG_SET (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_INSID)) \ 121 MVCC_SET_FLAG_BITS (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_INSID); \ 122 MVCC_SET_INSID (mvcc_rec_header_p, MVCCID_ALL_VISIBLE); \ 124 if (!MVCC_IS_FLAG_SET (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_DELID)) \ 126 MVCC_SET_FLAG_BITS (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_DELID); \ 127 MVCC_SET_DELID (mvcc_rec_header_p, MVCCID_NULL); \ 129 if (!MVCC_IS_FLAG_SET (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_PREV_VERSION)) \ 131 MVCC_SET_FLAG_BITS (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_PREV_VERSION); \ 132 LSA_SET_NULL(&(mvcc_rec_header_p)->prev_version_lsa); \ 137 #if defined (SERVER_MODE) 138 #define HEAP_UPDATE_IS_MVCC_OP(is_mvcc_class, update_style) \ 139 ((is_mvcc_class) && (!HEAP_IS_UPDATE_INPLACE (update_style)) ? (true) : (false)) 141 #define HEAP_UPDATE_IS_MVCC_OP(is_mvcc_class, update_style) (false) 144 #define HEAP_SCAN_ORDERED_HFID(scan) \ 145 (((scan) != NULL) ? (&(scan)->node.hfid) : (PGBUF_ORDERED_NULL_HFID)) 170 #define HEAP_NUM_BEST_SPACESTATS 10 173 #define HEAP_STATS_NEXT_BEST_INDEX(i) \ 174 (((i) + 1) % HEAP_NUM_BEST_SPACESTATS) 175 #define HEAP_STATS_PREV_BEST_INDEX(i) \ 176 (((i) == 0) ? (HEAP_NUM_BEST_SPACESTATS - 1) : ((i) - 1)); 228 #define HEAP_PAGE_FLAG_VACUUM_STATUS_MASK 0xC0000000 229 #define HEAP_PAGE_FLAG_VACUUM_ONCE 0x80000000 230 #define HEAP_PAGE_FLAG_VACUUM_UNKNOWN 0x40000000 232 #define HEAP_PAGE_SET_VACUUM_STATUS(chain, status) \ 235 assert ((status) == HEAP_PAGE_VACUUM_NONE \ 236 || (status) == HEAP_PAGE_VACUUM_ONCE \ 237 || (status) == HEAP_PAGE_VACUUM_UNKNOWN); \ 238 (chain)->flags &= ~HEAP_PAGE_FLAG_VACUUM_STATUS_MASK; \ 239 if ((status) == HEAP_PAGE_VACUUM_ONCE) \ 241 (chain)->flags |= HEAP_PAGE_FLAG_VACUUM_ONCE; \ 243 else if ((status) == HEAP_PAGE_VACUUM_UNKNOWN) \ 245 (chain)->flags |= HEAP_PAGE_FLAG_VACUUM_UNKNOWN; \ 250 #define HEAP_PAGE_GET_VACUUM_STATUS(chain) \ 251 (((chain)->flags & HEAP_PAGE_FLAG_VACUUM_STATUS_MASK) == 0 \ 252 ? HEAP_PAGE_VACUUM_NONE \ 253 : ((((chain)->flags & HEAP_PAGE_FLAG_VACUUM_STATUS_MASK) \ 254 == HEAP_PAGE_FLAG_VACUUM_ONCE) \ 255 ? HEAP_PAGE_VACUUM_ONCE : HEAP_PAGE_VACUUM_UNKNOWN)) 268 #define HEAP_CHK_ADD_UNFOUND_RELOCOIDS 100 291 #define DEFAULT_REPR_INCREMENT 16 363 #ifdef DEBUG_CLASSREPR_CACHE 365 pthread_mutex_t num_fix_entries_mutex;
376 PTHREAD_MUTEX_INITIALIZER,
380 PTHREAD_MUTEX_INITIALIZER,
384 #ifdef DEBUG_CLASSREPR_CACHE 385 , 0, PTHREAD_MUTEX_INITIALIZER
389 #define CLASSREPR_REPR_INCREMENT 10 390 #define CLASSREPR_HASH_SIZE (heap_Classrepr_cache.num_entries * 2) 391 #define REPR_HASH(class_oid) (OID_PSEUDO_KEY(class_oid)%CLASSREPR_HASH_SIZE) 393 #define HEAP_MAYNEED_DECACHE_GUESSED_LASTREPRS(class_oid, hfid) \ 396 if (heap_Classrepr != NULL && (hfid) != NULL) \ 398 if (HFID_IS_NULL (&(heap_Classrepr->rootclass_hfid))) \ 399 (void) boot_find_root_heap (&(heap_Classrepr->rootclass_hfid)); \ 400 if (HFID_EQ ((hfid), &(heap_Classrepr->rootclass_hfid))) \ 401 (void) heap_classrepr_decache_guessed_last (class_oid); \ 406 #define HEAP_CHNGUESS_FUDGE_MININDICES (100) 407 #define HEAP_NBITS_IN_BYTE (8) 408 #define HEAP_NSHIFTS (3) 409 #define HEAP_BITMASK (HEAP_NBITS_IN_BYTE - 1) 410 #define HEAP_NBITS_TO_NBYTES(bit_cnt) \ 411 ((unsigned int)((bit_cnt) + HEAP_BITMASK) >> HEAP_NSHIFTS) 412 #define HEAP_NBYTES_TO_NBITS(byte_cnt) ((unsigned int)(byte_cnt) << HEAP_NSHIFTS) 413 #define HEAP_NBYTES_CLEARED(byte_ptr, byte_cnt) \ 414 memset((byte_ptr), '\0', (byte_cnt)) 415 #define HEAP_BYTEOFFSET_OFBIT(bit_num) ((unsigned int)(bit_num) >> HEAP_NSHIFTS) 416 #define HEAP_BYTEGET(byte_ptr, bit_num) \ 417 ((unsigned char *)(byte_ptr) + HEAP_BYTEOFFSET_OFBIT(bit_num)) 419 #define HEAP_BITMASK_INBYTE(bit_num) \ 420 (1 << ((unsigned int)(bit_num) & HEAP_BITMASK)) 421 #define HEAP_BIT_GET(byte_ptr, bit_num) \ 422 (*HEAP_BYTEGET(byte_ptr, bit_num) & HEAP_BITMASK_INBYTE(bit_num)) 423 #define HEAP_BIT_SET(byte_ptr, bit_num) \ 424 (*HEAP_BYTEGET(byte_ptr, bit_num) = \ 425 *HEAP_BYTEGET(byte_ptr, bit_num) | HEAP_BITMASK_INBYTE(bit_num)) 426 #define HEAP_BIT_CLEAR(byte_ptr, bit_num) \ 427 (*HEAP_BYTEGET(byte_ptr, bit_num) = \ 428 *HEAP_BYTEGET(byte_ptr, bit_num) & ~HEAP_BITMASK_INBYTE(bit_num)) 476 static int heap_Maxslotted_reclength;
477 static int heap_Slotted_overhead = 4;
478 static const int heap_Find_best_page_limit = 100;
488 { 0,
NULL,
NULL, 0, 0, 0,
NULL, PTHREAD_MUTEX_INITIALIZER };
499 #define HEAP_RV_FLAG_VACUUM_STATUS_CHANGE 0x8000 501 #define HEAP_PERF_START(thread_p, context) \ 502 PERF_UTIME_TRACKER_START (thread_p, (context)->time_track) 503 #define HEAP_PERF_TRACK_PREPARE(thread_p, context) \ 506 if ((context)->time_track == NULL) break; \ 507 switch ((context)->type) { \ 508 case HEAP_OPERATION_INSERT: \ 509 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_INSERT_PREPARE); \ 511 case HEAP_OPERATION_DELETE: \ 512 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_DELETE_PREPARE); \ 514 case HEAP_OPERATION_UPDATE: \ 515 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_UPDATE_PREPARE); \ 522 #define HEAP_PERF_TRACK_EXECUTE(thread_p, context) \ 525 if ((context)->time_track == NULL) break; \ 526 switch ((context)->type) { \ 527 case HEAP_OPERATION_INSERT: \ 528 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, \ 529 (context)->time_track,\ 530 PSTAT_HEAP_INSERT_EXECUTE); \ 532 case HEAP_OPERATION_DELETE: \ 533 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_DELETE_EXECUTE); \ 535 case HEAP_OPERATION_UPDATE: \ 536 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_UPDATE_EXECUTE); \ 543 #define HEAP_PERF_TRACK_LOGGING(thread_p, context) \ 546 if ((context)->time_track == NULL) break; \ 547 switch ((context)->type) { \ 548 case HEAP_OPERATION_INSERT: \ 549 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_INSERT_LOG); \ 551 case HEAP_OPERATION_DELETE: \ 552 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_DELETE_LOG); \ 554 case HEAP_OPERATION_UPDATE: \ 555 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_UPDATE_LOG); \ 567 #define heap_scan_pb_lock_and_fetch(...) \ 568 heap_scan_pb_lock_and_fetch_debug (__VA_ARGS__, ARG_FILE_LINE) 573 const int caller_line);
577 static int heap_classrepr_initialize_cache (
void);
578 static int heap_classrepr_finalize_cache (
void);
579 static int heap_classrepr_decache_guessed_last (
const OID * class_oid);
582 const OID * class_oid);
583 static int heap_classrepr_unlock_class (
HEAP_CLASSREPR_HASH * hash_anchor,
const OID * class_oid,
int need_hash_mutex);
587 #ifdef DEBUG_CLASSREPR_CACHE 588 static int heap_classrepr_dump_cache (
bool simple_dump);
598 static int heap_stats_get_min_freespace (
HEAP_HDR_STATS * heap_hdr);
603 #if defined(ENABLE_UNUSED_FUNCTION) 604 static int heap_stats_quick_num_fit_in_bestspace (
HEAP_BESTSPACE * bestspace,
int num_entries,
int unit_size,
609 int record_length,
int needed_space,
614 VPID * hdr_vpid,
bool scan_all,
bool can_cycle);
624 static int heap_create_internal (
THREAD_ENTRY * thread_p,
HFID *
hfid,
const OID * class_oid,
const bool reuse_oid);
627 static int heap_reinitialize_page (
THREAD_ENTRY * thread_p,
PAGE_PTR pgptr,
const bool is_header_page);
628 #if defined(CUBRID_DEBUG) 634 static int heap_ovf_flush (
THREAD_ENTRY * thread_p,
const OID * ovf_oid);
635 static int heap_ovf_get_length (
THREAD_ENTRY * thread_p,
const OID * ovf_oid);
638 static int heap_ovf_get_capacity (
THREAD_ENTRY * thread_p,
const OID * ovf_oid,
int *ovf_len,
int *ovf_num_pages,
639 int *ovf_overhead,
int *ovf_free_space);
644 const OID * class_oid,
int cache_last_fix_page,
bool is_queryscan,
648 const OID * class_oid);
656 INT64 * num_recs_inovf,
INT64 * num_pages,
int *avg_freespace,
int *avg_freespace_nolast,
657 int *avg_reclength,
int *avg_overhead);
662 static int heap_attrinfo_recache_attrepr (
HEAP_CACHE_ATTRINFO * attr_info,
bool islast_reset);
668 static int heap_attrinfo_get_disksize (
HEAP_CACHE_ATTRINFO * attr_info,
bool is_mvcc_class,
int *offset_size_ptr);
681 int func_col_id,
int func_attr_index_start);
692 #if defined (SA_MODE) 700 static int heap_chkreloc_print_notfound (
const void *ignore_reloc_oid,
void *ent,
void *xchk);
703 static int heap_chnguess_initialize (
void);
704 static int heap_chnguess_realloc (
void);
705 static int heap_chnguess_finalize (
void);
706 static int heap_chnguess_decache (
const OID * oid);
707 static int heap_chnguess_remove_entry (
const void *oid_key,
void *ent,
void *xignore);
709 static int heap_stats_bestspace_initialize (
void);
710 static int heap_stats_bestspace_finalize (
void);
712 static int heap_get_spage_type (
void);
713 static bool heap_is_reusable_oid (
const FILE_TYPE file_type);
717 int lob_create_flag);
724 static int heap_get_partitions_from_subclasses (
THREAD_ENTRY * thread_p,
const OID * subclasses,
int *parts_count,
727 HFID * class_hfid,
REPR_ID * repr_id,
int *has_partition_info);
728 static int heap_get_partition_attributes (
THREAD_ENTRY * thread_p,
const OID * cls_oid,
ATTR_ID * type_id,
730 static int heap_get_class_subclasses (
THREAD_ENTRY * thread_p,
const OID * class_oid,
int *count,
OID ** subclasses);
732 static unsigned int heap_hash_vpid (
const void *key_vpid,
unsigned int htsize);
733 static int heap_compare_vpid (
const void *key_vpid1,
const void *key_vpid2);
734 static unsigned int heap_hash_hfid (
const void *key_hfid,
unsigned int htsize);
735 static int heap_compare_hfid (
const void *key_hfid1,
const void *key_hfid2);
737 static char *heap_bestspace_to_string (
char *buf,
int buf_size,
const HEAP_BESTSPACE * hb);
739 static int fill_string_to_buffer (
char **
start,
char *
end,
const char *str);
746 bool reversed_direction,
DB_VALUE ** cache_recordinfo);
763 #if defined(ENABLE_UNUSED_FUNCTION) 770 const VPID * fwd_vpid_p,
const OID * fwd_oid_p,
774 const VPID * home_vpid_p,
const OID * oid_p,
778 int *again_count,
int again_max)
786 static int heap_mark_class_as_modified (
THREAD_ENTRY * thread_p,
OID * oid_p,
int chn,
bool decache);
791 static void heap_build_forwarding_recdes (
RECDES * recdes_p, INT16 rec_type,
OID * forward_oid);
806 RECDES * recdes_p,
bool is_mvcc_op,
bool is_redistribute_op);
809 static void heap_delete_adjust_header (
MVCC_REC_HEADER * header_p,
MVCCID mvcc_id,
bool need_mvcc_header_max_size);
826 static void *heap_hfid_table_entry_alloc (
void);
827 static int heap_hfid_table_entry_free (
void *unique_stat);
828 static int heap_hfid_table_entry_init (
void *unique_stat);
829 static int heap_hfid_table_entry_key_copy (
void *src,
void *
dest);
830 static unsigned int heap_hfid_table_entry_key_hash (
void *key,
int hash_table_size);
831 static int heap_hfid_table_entry_key_compare (
void *
k1,
void *k2);
837 bool vacuum_status_change);
840 OID * partition_oid);
869 heap_hash_vpid (
const void *key_vpid,
unsigned int htsize)
883 heap_compare_vpid (
const void *key_vpid1,
const void *key_vpid2)
885 const VPID *vpid1 = (
VPID *) key_vpid1;
886 const VPID *vpid2 = (
VPID *) key_vpid2;
898 heap_hash_hfid (
const void *key_hfid,
unsigned int htsize)
912 heap_compare_hfid (
const void *key_hfid1,
const void *key_hfid2)
914 const HFID *hfid1 = (
HFID *) key_hfid1;
915 const HFID *hfid2 = (
HFID *) key_hfid2;
1022 (void) heap_stats_entry_free (thread_p, ent,
NULL);
1031 (void) heap_stats_entry_free (thread_p, ent,
NULL);
1066 (void) heap_stats_entry_free (thread_p, ent,
NULL);
1072 assert (del_cnt <= heap_Bestspace->num_stats_entries);
1104 (void) heap_stats_entry_free (thread_p, ent,
NULL);
1167 #if defined (NDEBUG) 1175 const char *caller_file,
const int caller_line)
1182 if (scan_cache !=
NULL)
1210 if (pg_watcher !=
NULL)
1212 #if defined (NDEBUG) 1213 if (pgbuf_ordered_fix_release (thread_p, vpid_ptr,
fetch_mode, page_latch_mode, pg_watcher) !=
NO_ERROR)
1216 caller_file, caller_line) !=
NO_ERROR)
1221 pgptr = pg_watcher->
pgptr;
1225 #if defined (NDEBUG) 1250 return (length > heap_Maxslotted_reclength) ?
true :
false;
1258 heap_get_spage_type (
void)
1269 heap_is_reusable_oid (
const FILE_TYPE file_type)
1293 heap_classrepr_initialize_cache (
void)
1301 if (heap_Classrepr !=
NULL)
1303 ret = heap_classrepr_finalize_cache ();
1313 heap_Classrepr_cache.
area =
1315 if (heap_Classrepr_cache.
area ==
NULL)
1323 cache_entry = heap_Classrepr_cache.
area;
1328 cache_entry[
i].
idx =
i;
1329 cache_entry[
i].
fcnt = 0;
1341 if (cache_entry[
i].repr ==
NULL)
1347 memset (cache_entry[
i].repr, 0, cache_entry[
i].max_reprid *
sizeof (
OR_CLASSREP *));
1363 hash_entry = heap_Classrepr_cache.
hash_table;
1364 for (
i = 0;
i < heap_Classrepr_cache.
num_hash;
i++)
1367 hash_entry[
i].
idx =
i;
1381 lock_entry = heap_Classrepr_cache.
lock_table;
1400 heap_Classrepr = &heap_Classrepr_cache;
1420 heap_classrepr_finalize_cache (
void)
1427 if (heap_Classrepr ==
NULL)
1432 #ifdef DEBUG_CLASSREPR_CACHE 1433 ret = heap_classrepr_dump_anyfixed ();
1441 cache_entry = heap_Classrepr_cache.
area;
1446 if (cache_entry[
i].repr ==
NULL)
1454 if (cache_entry[
i].repr[
j] !=
NULL)
1462 if (heap_Classrepr_cache.
area !=
NULL)
1469 hash_entry = heap_Classrepr_cache.
hash_table;
1470 for (
i = 0; hash_entry !=
NULL &&
i < heap_Classrepr_cache.
num_hash;
i++)
1474 heap_Classrepr_cache.
num_hash = -1;
1493 heap_Classrepr =
NULL;
1511 if (cache_entry ==
NULL)
1532 t = cache_entry->
repr;
1538 cache_entry->
repr = t;
1598 heap_classrepr_decache_guessed_last (
const OID * class_oid)
1605 if (class_oid !=
NULL)
1644 if (cache_entry ==
NULL)
1658 while (cur_entry !=
NULL)
1660 if (cur_entry == cache_entry)
1664 prev_entry = cur_entry;
1669 if (cur_entry ==
NULL)
1678 if (prev_entry ==
NULL)
1696 (void) heap_classrepr_entry_remove_from_LRU (cache_entry);
1703 if (cache_entry->
fcnt == 0)
1706 ret = heap_classrepr_entry_reset (cache_entry);
1709 ret = heap_classrepr_entry_free (cache_entry);
1743 ret = heap_classrepr_decache_guessed_last (class_oid);
1755 ret = heap_chnguess_decache (class_oid);
1787 if (*idx_incache < 0)
1793 cache_entry = &heap_Classrepr_cache.
area[*idx_incache];
1796 cache_entry->
fcnt--;
1797 if (cache_entry->
fcnt == 0)
1802 #ifdef DEBUG_CLASSREPR_CACHE 1804 heap_Classrepr_cache.num_fix_entries--;
1812 ret = heap_classrepr_entry_free (cache_entry);
1815 ret = heap_classrepr_entry_reset (cache_entry);
1827 (void) heap_classrepr_entry_remove_from_LRU (cache_entry);
1857 { NEED_TO_RETRY = 0, LOCK_ACQUIRED };
1872 if (thread_p ==
NULL)
1875 if (thread_p ==
NULL)
1880 cur_thrd_entry = thread_p;
1882 for (cur_lock_entry = hash_anchor->
lock_next; cur_lock_entry !=
NULL; cur_lock_entry = cur_lock_entry->
lock_next)
1895 return NEED_TO_RETRY;
1906 cur_lock_entry = &heap_Classrepr_cache.
lock_table[cur_thrd_entry->index];
1910 hash_anchor->
lock_next = cur_lock_entry;
1914 return LOCK_ACQUIRED;
1925 heap_classrepr_unlock_class (
HEAP_CLASSREPR_HASH * hash_anchor,
const OID * class_oid,
int need_hash_mutex)
1932 if (need_hash_mutex)
1937 prev_lock_entry =
NULL;
1938 cur_lock_entry = hash_anchor->
lock_next;
1939 while (cur_lock_entry !=
NULL)
1945 prev_lock_entry = cur_lock_entry;
1946 cur_lock_entry = cur_lock_entry->
lock_next;
1950 if (cur_lock_entry ==
NULL)
1956 if (prev_lock_entry ==
NULL)
1970 cur_thrd_entry->next_wait_thrd =
NULL;
1985 heap_classrepr_entry_alloc (
void)
1998 goto check_LRU_list;
2031 if (cache_entry->
fcnt == 0)
2034 (void) heap_classrepr_entry_remove_from_LRU (cache_entry);
2042 if (cache_entry ==
NULL)
2049 if (cache_entry->
fcnt != 0)
2052 goto check_LRU_list;
2060 while (cur_entry !=
NULL)
2062 if (cur_entry == cache_entry)
2066 prev_entry = cur_entry;
2070 if (cur_entry ==
NULL)
2078 if (prev_entry ==
NULL)
2089 (void) heap_classrepr_entry_reset (cache_entry);
2142 if (last_reprid !=
NULL)
2147 if (class_recdes !=
NULL)
2162 if (last_reprid !=
NULL)
2168 if (class_recdes ==
NULL)
2239 if (cache_entry ==
NULL)
2241 if (repr_from_record ==
NULL)
2251 if (page_of_class ==
NULL)
2262 repr_from_record = heap_classrepr_get_from_record (thread_p, &last_reprid, class_oid, class_recdes, reprid);
2263 if (repr_from_record ==
NULL)
2267 if (page_of_class !=
NULL)
2276 reprid = last_reprid;
2278 if (reprid != last_reprid && repr_last ==
NULL)
2280 repr_last = heap_classrepr_get_from_record (thread_p, &last_reprid, class_oid, class_recdes, last_reprid);
2281 if (repr_last ==
NULL)
2286 if (page_of_class ==
NULL)
2303 r = heap_classrepr_lock_class (thread_p, hash_anchor, class_oid);
2304 if (r != LOCK_ACQUIRED)
2306 if (r == NEED_TO_RETRY)
2319 cache_entry = heap_classrepr_entry_alloc ();
2320 if (cache_entry ==
NULL)
2326 (void) heap_classrepr_unlock_class (hash_anchor, class_oid,
true);
2329 if (repr_last !=
NULL)
2335 return repr_from_record;
2350 (void) heap_classrepr_entry_free (cache_entry);
2352 (void) heap_classrepr_unlock_class (hash_anchor, class_oid,
true);
2366 if (reprid <= NULL_REPRID || reprid > last_reprid || reprid > cache_entry->
max_reprid)
2371 (void) heap_classrepr_entry_free (cache_entry);
2373 (void) heap_classrepr_unlock_class (hash_anchor, class_oid,
true);
2386 cache_entry->
repr[reprid] = repr_from_record;
2387 repr = cache_entry->
repr[reprid];
2388 repr_from_record =
NULL;
2390 if (reprid != last_reprid)
2394 cache_entry->
repr[last_reprid] = repr_last;
2398 cache_entry->
fcnt = 1;
2400 #ifdef DEBUG_CLASSREPR_CACHE 2402 heap_Classrepr_cache.num_fix_entries++;
2406 *idx_incache = cache_entry->
idx;
2414 (void) heap_classrepr_unlock_class (hash_anchor, class_oid,
false);
2438 repr = cache_entry->
repr[reprid];
2442 if (repr_from_record ==
NULL)
2447 heap_classrepr_get_from_record (thread_p, &last_reprid, class_oid, class_recdes, reprid);
2448 if (repr_from_record ==
NULL)
2458 cache_entry->
repr[reprid] = repr_from_record;
2459 repr = repr_from_record;
2460 repr_from_record =
NULL;
2466 cache_entry->
fcnt++;
2467 *idx_incache = cache_entry->
idx;
2472 if (repr_from_record !=
NULL)
2476 if (repr_last !=
NULL)
2483 #ifdef DEBUG_CLASSREPR_CACHE 2492 heap_classrepr_dump_cache (
bool simple_dump)
2500 if (heap_Classrepr ==
NULL)
2505 (void) fflush (stderr);
2506 (void) fflush (stdout);
2508 fprintf (stdout,
"*** Class Representation cache dump *** \n");
2509 fprintf (stdout,
" Number of entries = %d, Number of used entries = %d\n", heap_Classrepr->
num_entries,
2512 for (cache_entry = heap_Classrepr->
area,
i = 0; i < heap_Classrepr->num_entries; cache_entry++,
i++)
2514 fprintf (stdout,
" \nEntry_id %d\n", cache_entry->
idx);
2519 classrepr = cache_entry->
repr[
j];
2520 if (classrepr ==
NULL)
2522 fprintf (stdout,
".....\n");
2525 fprintf (stdout,
" Fix count = %d, force_decache = %d\n", cache_entry->
fcnt, cache_entry->
force_decache);
2527 if (simple_dump ==
true)
2529 fprintf (stdout,
" Class_oid = %d|%d|%d, Reprid = %d\n", (
int) cache_entry->
class_oid.
volid,
2531 fprintf (stdout,
" Representation address = %p\n", classrepr);
2536 ret = heap_classrepr_dump (&cache_entry->
class_oid, classrepr);
2562 const char *attr_name;
2570 char *index_name =
NULL;
2571 char *
string =
NULL;
2572 int alloced_string = 0;
2598 " Class-OID = %d|%d|%d, Classname = %s, reprid = %d,\n" 2599 " Attrs: Tot = %d, Nfix = %d, Nvar = %d, Nshare = %d, Nclass = %d,\n Total_length_of_fixattrs = %d\n",
2607 fprintf (fp,
" Attribute Specifications:\n");
2610 for (
i = 0, attrepr = repr->
attributes; i < repr->n_attributes;
i++, attrepr++)
2622 if (attr_name ==
NULL)
2624 attr_name =
"?????";
2627 fprintf (fp,
"\n Attrid = %d, Attrname = %s, type = %s,\n location = %d, position = %d,\n", attrepr->
id,
2630 if (
string !=
NULL && alloced_string == 1)
2642 fprintf (fp,
" Inherited from Class: oid = %d|%d|%d, Name = %s\n", (
int) attrepr->
classoid.
volid,
2649 fprintf (fp,
" Number of Btids = %d,\n", attrepr->
n_btids);
2663 fprintf (fp,
" BTID: VFID %d|%d, Root_PGID %d, %s\n", (
int) attrepr->
btids[
k].
vfid.
volid,
2665 (index_name ==
NULL) ?
"unknown" : index_name);
2672 fprintf (fp,
" Default disk value format:\n");
2677 fprintf (fp,
"NULL");
2684 switch (_setjmp (buf.
env))
2703 fprintf (fp,
"PR_TYPE is NULL");
2710 fprintf (fp,
"Error transforming the default value\n");
2725 fprintf (fp,
"Dump has been aborted...");
2730 #ifdef DEBUG_CLASSREPR_CACHE 2748 heap_classrepr_dump_anyfixed (
void)
2752 if (heap_Classrepr->num_fix_entries > 0)
2755 ret = heap_classrepr_dump_cache (
true);
2787 if (min_freespace < (header_size + 20))
2789 min_freespace = header_size + 20;
2794 min_freespace = header_size + 20;
2801 return min_freespace;
2823 int freespace,
error;
2829 if (prev_freespace < freespace)
2834 (void) heap_stats_add_bestspace (thread_p,
hfid,
vpid, freespace);
2845 error = heap_stats_update_internal (thread_p,
hfid,
vpid, freespace);
2850 else if (need_update ==
true)
2855 else if (need_update ==
true)
2893 if (hdr_pgptr ==
NULL)
2913 if (free_space >= heap_stats_get_min_freespace (heap_hdr))
2961 addr.
pgptr = hdr_pgptr;
3066 #if defined(ENABLE_UNUSED_FUNCTION) 3081 heap_stats_quick_num_fit_in_bestspace (
HEAP_BESTSPACE * bestspace,
int num_entries,
int unit_size,
int unfill_space)
3083 int total_nunits = 0;
3091 for (
i = 0;
i < num_entries;
i++)
3093 if ((bestspace[
i].freespace - unfill_space) >= unit_size)
3098 total_nunits += (bestspace[
i].
freespace - unfill_space) / unit_size;
3102 return total_nunits;
3125 int *idx_badspace,
int record_length,
int needed_space,
HEAP_SCANCACHE * scan_cache,
3128 #define BEST_PAGE_SEARCH_MAX_COUNT 100 3137 int i, best_array_index = -1;
3138 bool hash_is_available;
3139 bool best_hint_is_used;
3154 best_array_index = 0;
3160 best_hint_is_used =
false;
3162 if (hash_is_available)
3179 (void) heap_stats_entry_free (thread_p, ent,
NULL);
3196 if (bestspace[best_array_index].freespace >= needed_space)
3198 best.
vpid = bestspace[best_array_index].
vpid;
3201 best_hint_is_used =
true;
3224 #if defined (SERVER_MODE) 3252 if (best_hint_is_used ==
true)
3256 bestspace[best_array_index].
freespace = 0;
3260 (void) heap_stats_del_bestspace_by_vpid (thread_p, &best.
vpid);
3278 best.
freespace -= record_length + heap_Slotted_overhead;
3282 if (hash_is_available)
3288 if (best_hint_is_used ==
true)
3304 if (best_hint_is_used)
3320 if (bestspace[idx_worstspace].freespace > bestspace[
i].freespace)
3337 *idx_badspace = idx_worstspace;
3363 heap_stats_find_best_page (
THREAD_ENTRY * thread_p,
const HFID *
hfid,
int needed_space,
bool isnew_rec,
3372 int try_find, try_sync;
3373 int num_pages_found;
3374 float other_high_best_ratio;
3421 if (isnew_rec ==
true)
3433 total_space = needed_space + heap_Slotted_overhead + heap_hdr->
unfill_space;
3436 total_space = needed_space + heap_Slotted_overhead;
3463 other_high_best_ratio = 0;
3467 other_high_best_ratio =
3484 if (scan_cache !=
NULL)
3497 "heap_stats_find_best_page: call heap_stats_sync_bestspace() " 3498 "hfid { vfid { fileid %d volid %d } hpgid %d } hdr_vpid { pageid %d volid %d } " 3500 hdr_vpidp->
volid, 0);
3502 num_pages_found = heap_stats_sync_bestspace (thread_p,
hfid, heap_hdr, hdr_vpidp,
false,
true);
3503 if (num_pages_found < 0)
3510 while (num_pages_found == 0 && try_sync <= 2);
3513 if (num_pages_found <= 0)
3526 if (heap_vpid_alloc (thread_p,
hfid, hdr_page_watcher.
pgptr, heap_hdr, scan_cache, pg_watcher) !=
NO_ERROR)
3540 return pg_watcher->
pgptr;
3565 bool scan_all,
bool can_cycle)
3567 int i, best, num_high_best, num_other_best, start_pos;
3574 float recs_sumlen = 0.0;
3578 int npages = 0, nrecords = 0, rec_length;
3579 int num_iterations = 0, max_iterations;
3581 bool iterate_all =
false;
3582 bool search_all =
false;
3585 #if defined (CUBRID_DEBUG) 3598 min_freespace = heap_stats_get_min_freespace (heap_hdr);
3602 num_high_best = num_other_best = 0;
3604 if (scan_all !=
true)
3623 start_vpid = next_vpid;
3636 if (heap_stats_get_second_best (heap_hdr, &next_vpid) !=
NO_ERROR)
3648 if (search_all ==
true)
3654 start_vpid = next_vpid;
3659 if (can_cycle ==
true)
3661 stopat_vpid = next_vpid;
3672 start_vpid = next_vpid;
3688 while (!
VPID_ISNULL (&next_vpid) || can_cycle ==
true)
3690 if (can_cycle ==
true &&
VPID_ISNULL (&next_vpid))
3702 && (can_cycle ==
true || !
VPID_EQ (&next_vpid, &stopat_vpid)))
3704 if (scan_all ==
false)
3706 if (++num_iterations > max_iterations)
3709 "heap_stats_sync_bestspace: num_iterations %d best %d " 3710 "next_vpid { pageid %d volid %d }\n", num_iterations, num_high_best, next_vpid.
pageid,
3716 if (start_pos != -1 && num_high_best == 0)
3720 best_pages_hint_p[start_pos].
freespace = 0;
3757 num_pages += npages;
3758 num_recs += nrecords;
3759 recs_sumlen += rec_length;
3767 (void) heap_stats_add_bestspace (thread_p,
hfid, &
vpid, free_space);
3772 best_pages_hint_p[best].
vpid =
vpid;
3773 best_pages_hint_p[best].
freespace = free_space;
3793 if (scan_all ==
false 3795 || (can_cycle ==
false &&
VPID_EQ (&next_vpid, &stopat_vpid))))
3804 "heap_stats_sync_bestspace: scans from {%d|%d} to {%d|%d}, num_iterations(%d) " 3806 num_iterations, max_iterations, num_high_best);
3863 #if defined (CUBRID_DEBUG) 3866 elapsed = (float) tv_diff.tv_sec * 1000000;
3867 elapsed += (
float) tv_diff.tv_usec;
3873 return num_high_best;
3904 #if !defined (NDEBUG) 3934 VPID vpid_heap_header;
3953 if (hdr_stats ==
NULL)
4042 memcpy (chain,
recdes.
data, sizeof (*chain));
4131 error_code = heap_get_last_page (thread_p,
hfid, heap_hdr, scan_cache, &last_vpid, &last_pg_watcher);
4152 new_page_chain.
flags = 0;
4166 if (last_pg_watcher.
pgptr == hdr_pgptr)
4185 chain_prev = *chain;
4228 addr.
pgptr = hdr_pgptr;
4230 &heap_hdr_prev, heap_hdr);
4395 memcpy (&chain,
recdes.
data, sizeof (chain));
4456 memcpy (&chain,
recdes.
data, sizeof (chain));
4498 (void) heap_stats_del_bestspace_by_vpid (thread_p, rm_vpid);
4541 bool is_system_op_started =
false;
4584 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4591 *page_ptr = crt_watcher.
pgptr;
4600 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4611 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4624 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4634 *page_ptr = crt_watcher.
pgptr;
4640 "Candidate heap page %d|%d to remove was changed and has new data.", page_vpid.
volid,
4652 "Candidate heap page %d|%d to remove has waiters.", page_vpid.
volid, page_vpid.
pageid);
4669 is_system_op_started =
true;
4673 copy_recdes.
area_size =
sizeof (heap_hdr);
4678 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4681 memcpy (&heap_hdr, copy_recdes.
data, sizeof (heap_hdr));
4701 if (
VPID_EQ (&prev_vpid, &header_vpid))
4712 update_recdes.
data = (
char *) &heap_hdr;
4713 update_recdes.
length =
sizeof (heap_hdr);
4718 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4722 sizeof (heap_hdr),
sizeof (heap_hdr), copy_recdes.
data, update_recdes.
data);
4737 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4741 memcpy (&chain, copy_recdes.
data, copy_recdes.
length);
4743 update_recdes.
data = (
char *) &chain;
4744 update_recdes.
length =
sizeof (chain);
4749 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4754 sizeof (chain),
sizeof (chain), copy_recdes.
data, update_recdes.
data);
4767 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4771 memcpy (&chain, copy_recdes.
data, sizeof (chain));
4773 update_recdes.
data = (
char *) &chain;
4774 update_recdes.
length =
sizeof (chain);
4780 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4785 sizeof (chain),
sizeof (chain), copy_recdes.
data, update_recdes.
data);
4796 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4801 (void) heap_stats_del_bestspace_by_vpid (thread_p, &page_vpid);
4805 is_system_op_started =
false;
4823 if (is_system_op_started)
4839 if (*page_ptr !=
NULL)
4841 if (*page_ptr != crt_watcher.
pgptr)
4845 *page_ptr = crt_watcher.
pgptr;
4959 #define HEAP_MAX_FIRSTSLOTID_LENGTH (sizeof (HEAP_HDR_STATS)) 4965 ret = heap_chnguess_initialize ();
4971 ret = heap_classrepr_initialize_cache ();
4978 ret = heap_stats_bestspace_initialize ();
5000 ret = heap_chnguess_finalize ();
5006 ret = heap_classrepr_finalize_cache ();
5012 ret = heap_stats_bestspace_finalize ();
5065 if (class_oid ==
NULL)
5067 class_oid = &null_oid;
5072 memset (&des, 0,
sizeof (des));
5090 if (heap_reuse (thread_p,
hfid, class_oid, reuse_oid) ==
NULL)
5164 (void) heap_stats_del_bestspace_by_hfid (thread_p,
hfid);
5172 memset (&heap_hdr, 0,
sizeof (heap_hdr));
5281 bool something_deleted =
false;
5303 something_deleted =
true;
5306 return something_deleted;
5413 if (hdr_pgptr ==
NULL)
5447 is_header_page = (hdr_pgptr == pgptr) ? 1 : 0;
5454 (void) heap_delete_all_page_records (thread_p, &
vpid, pgptr);
5457 addr.
offset = is_header_page;
5464 if (heap_reinitialize_page (thread_p, pgptr, is_header_page) !=
NO_ERROR)
5471 addr.
offset = is_header_page;
5557 addr.
pgptr = hdr_pgptr;
5570 if (hdr_pgptr !=
NULL)
5578 #if defined(CUBRID_DEBUG) 5613 if (scan_range !=
NULL)
5615 valid_pg = heap_hfid_isvalid (&scan_range->
scan_cache.hfid);
5646 return heap_create_internal (thread_p,
hfid, class_oid, reuse_oid);
5675 (void) heap_stats_del_bestspace_by_hfid (thread_p,
hfid);
5718 (void) heap_stats_del_bestspace_by_hfid (thread_p,
hfid);
5792 if (expected_length <= 0)
5801 expected_length = -expected_length;
5891 forward_recdes.
data = (
char *) &forward_oid;
5927 forward_recdes.
data = (
char *) &forward_oid;
5936 ret = heap_ovf_flush (thread_p, &forward_oid);
6000 int npages, nrecords, rec_length;
6023 hdr_recdes.
data = (
char *) &heap_hdr;
6024 hdr_recdes.
area_size =
sizeof (heap_hdr);
6033 memcpy (&initial_heap_hdr, hdr_recdes.
data, sizeof (initial_heap_hdr));
6071 curr_page_watcher.
pgptr =
6130 if (heap_vpid_remove (thread_p,
hfid, &heap_hdr, &
vpid) ==
NULL)
6158 heap_stats_put_second_best (&heap_hdr, &
vpid);
6163 (void) heap_stats_add_bestspace (thread_p,
hfid, &
vpid, free_space);
6186 &initial_heap_hdr, hdr_recdes.
data);
6257 if (docreate ==
true)
6266 memset (&des, 0,
sizeof (des));
6381 ovf_vfid_p = (ovf_vfid_p !=
NULL) ? ovf_vfid_p : &ovf_vfid;
6500 heap_ovf_get_capacity (
THREAD_ENTRY * thread_p,
const OID * ovf_oid,
int *ovf_len,
int *ovf_num_pages,
6501 int *ovf_overhead,
int *ovf_free_space)
6508 return overflow_get_capacity (thread_p, &ovf_vpid, ovf_len, ovf_num_pages, ovf_overhead, ovf_free_space);
6527 if (*scan_cache !=
NULL)
6543 r = heap_scancache_reset_modify (thread_p, *scan_cache,
hfid, class_oid);
6572 const OID * class_oid,
int cache_last_fix_page,
bool is_queryscan,
int is_indexscan,
6577 if (class_oid !=
NULL)
6584 if (is_queryscan ==
true)
6692 return heap_scancache_start_internal (thread_p, scan_cache,
hfid, class_oid, cache_last_fix_page,
true, is_indexscan,
6727 int classrepr_cacheindex = -1;
6736 if (class_oid !=
NULL)
6738 ret = heap_scancache_reset_modify (thread_p, scan_cache,
hfid, class_oid);
6753 if (classrepr ==
NULL)
6835 const OID * class_oid)
6839 ret = heap_scancache_force_modify (thread_p, scan_cache);
6845 if (class_oid !=
NULL)
6915 heap_scancache_quick_start_internal (scan_cache,
NULL);
6931 heap_scancache_quick_start_internal (scan_cache,
NULL);
7012 if (scan_cache->
area)
7024 while (curr_node !=
NULL)
7026 next_node = curr_node->
next;
7028 curr_node = next_node;
7063 ret = heap_scancache_quick_end (thread_p, scan_cache);
7081 ret = heap_scancache_end_internal (thread_p, scan_cache,
END_SCAN);
7096 ret = heap_scancache_end_internal (thread_p, scan_cache,
CONTINUE_SCAN);
7116 ret = heap_scancache_force_modify (thread_p, scan_cache);
7119 ret = heap_scancache_quick_end (thread_p, scan_cache);
7169 if (ispeeking ==
PEEK)
7276 #if defined (SA_MODE) 7277 bool is_system_class =
false;
7360 if (try_count++ < try_max)
7441 #if defined(SA_MODE) 7448 if (is_system_class ==
true)
7518 oid = context->
oid_p;
7615 && heap_scan_cache_allocate_recdes_data (thread_p, scan_cache_p, context->
recdes_p,
7625 return heap_get_bigone_content (thread_p, scan_cache_p, context->
ispeeking, &context->
forward_oid,
7629 && heap_scan_cache_allocate_recdes_data (thread_p, scan_cache_p, context->
recdes_p,
7668 VPID *vpidptr_incache;
7673 int get_rec_info = cache_recordinfo !=
NULL;
7674 bool is_null_recdata;
7680 #if defined(CUBRID_DEBUG) 7690 "heap_next: scan_cache without heap.. heap file must be given to heap_scancache_start () when" 7691 " scan_cache is used with heap_first, heap_next, heap_prev heap_last");
7709 if (reversed_direction)
7767 curr_page_watcher.
pgptr =
7769 &curr_page_watcher);
7791 if (reversed_direction)
7815 if (reversed_direction)
7849 if (reversed_direction)
7894 heap_get_record_info (thread_p, oid,
recdes, forward_recdes, &curr_page_watcher, scan_cache, ispeeking,
7929 if (is_null_recdata)
7940 if (is_null_recdata)
8026 #if defined (ENABLE_UNUSED_FUNCTION) 8168 if (start_oid !=
NULL)
8278 if (last_oid !=
NULL)
8433 #if defined (ENABLE_UNUSED_FUNCTION) 8611 bool doesexist =
true;
8613 bool old_check_interrupt;
8675 if (class_oid ==
NULL)
8677 class_oid = &tmp_oid;
8743 bool doesexist =
false;
8749 bool is_scancache_started =
false;
8767 if (class_oid ==
NULL)
8769 class_oid = &local_class_oid;
8776 is_scancache_started =
true;
8779 if (mvcc_snapshot_ptr ==
NULL)
8785 copy_mvcc_snapshot = *mvcc_snapshot_ptr;
8803 if (is_scancache_started)
8913 if (hdr_pgptr ==
NULL)
8954 int ignore_npages = -1;
8955 int ignore_avg_reclen = -1;
8958 if (
heap_estimate (thread_p,
hfid, &ignore_npages, &nobjs, &ignore_avg_reclen) == -1)
8983 if (
heap_estimate (thread_p,
hfid, &ignore_npages, &ignore_nobjs, &avg_reclen) == -1)
9009 INT64 * num_recs_inovf,
INT64 * num_pages,
int *avg_freespace,
int *avg_freespace_nolast,
9010 int *avg_reclength,
int *avg_overhead)
9024 INT64 sum_freespace = 0;
9025 INT64 sum_reclength = 0;
9026 INT64 sum_overhead = 0;
9038 *num_recs_relocated = 0;
9039 *num_recs_inovf = 0;
9066 sum_freespace += last_freespace;
9079 *num_recs_relocated += 1;
9097 *num_recs_inovf += 1;
9101 if (heap_ovf_get_capacity (thread_p, ovf_oid, &ovf_len, &ovf_num_pages, &ovf_overhead,
9104 sum_reclength += ovf_len;
9105 *num_pages += ovf_num_pages;
9106 sum_freespace += ovf_free_space;
9107 sum_overhead += ovf_overhead;
9143 *avg_freespace_nolast = ((*num_pages > 1) ? (
int) ((sum_freespace - last_freespace) / (*num_pages - 1)) : 0);
9144 *avg_freespace = (
int) (sum_freespace / *num_pages);
9145 *avg_overhead = (
int) (sum_overhead / *num_pages);
9150 *avg_reclength = (
int) (sum_reclength / *num_recs);
9244 char **classname_out)
9246 char *classname =
NULL;
9256 if (guess_classname ==
NULL || strcmp (guess_classname, classname) != 0)
9261 *classname_out =
strdup (classname);
9262 if (*classname_out ==
NULL)
9265 (
strlen (classname) + 1) *
sizeof (
char));
9274 *classname_out = guess_classname;
9280 *classname_out =
NULL;
9327 if (requested_num_attrs == 0)
9338 if (requested_num_attrs < 0)
9383 if (requested_num_attrs < 0)
9387 else if (requested_num_attrs >
9391 fprintf (stdout,
" XXX There are not that many attributes. Num_attrs = %d, Num_requested_attrs = %d\n",
9393 requested_num_attrs =
9398 if (requested_num_attrs > 0)
9422 value = &attr_info->
values[
i];
9429 value->
attrid = *attrids++;
9442 if (heap_attrinfo_recache_attrepr (attr_info,
true) !=
NO_ERROR)
9490 value = &attr_info->
values[
i];
9491 if (value !=
NULL && value->
attrid == attrid)
9504 if (new_values ==
NULL)
9509 attr_info->
values = new_values;
9524 if (heap_attrinfo_recache_attrepr (attr_info,
true) !=
NO_ERROR 9573 int num_found_attrs;
9575 int srch_num_shared;
9585 if (islast_reset ==
true)
9598 for (num_found_attrs = 0, curr_attr = 0; curr_attr < attr_info->
num_values; curr_attr++)
9604 isattr_found =
false;
9605 if (islast_reset ==
true)
9614 value = &attr_info->
values[curr_attr];
9619 value->
attrid = search_attrepr[curr_attr].
id;
9622 for (
i = 0; isattr_found ==
false &&
i < srch_num_attrs;
i++, search_attrepr++)
9627 if (value->
attrid == search_attrepr->
id)
9633 isattr_found =
true;
9635 if (islast_reset ==
true)
9675 isattr_found ==
false &&
i < srch_num_shared;
i++, search_attrepr++)
9680 if (value->
attrid == search_attrepr->
id)
9686 isattr_found =
true;
9713 i++, search_attrepr++)
9719 if (value->
attrid == search_attrepr->
id)
9725 isattr_found =
true;
9727 if (islast_reset ==
true)
9753 if (num_found_attrs != attr_info->
num_values && islast_reset ==
true)
9821 value = &attr_info->
values[
i];
9837 value = &attr_info->
values[
i];
9848 if (heap_attrinfo_recache_attrepr (attr_info,
false) !=
NO_ERROR)
9885 ret = heap_attrinfo_recache (thread_p,
NULL_REPRID, attr_info);
9931 value = &attr_info->
values[
i];
9939 if (attrepr !=
NULL)
9972 char *disk_data =
NULL;
9973 int disk_bound =
false;
9974 volatile int disk_length = -1;
9996 if (disk_length > 0)
10075 if (disk_data ==
NULL || disk_bound ==
false)
10081 goto exit_on_error;
10093 switch (_setjmp (buf.
env))
10137 char *disk_data =
NULL;
10161 if (found ==
false)
10201 if (disk_data !=
NULL)
10205 or_init (&buf, disk_data, -1);
10255 ret = heap_attrinfo_recache (thread_p, reprid, attr_info);
10258 goto exit_on_error;
10269 value = &attr_info->
values[
i];
10270 ret = heap_attrvalue_read (
recdes, value, attr_info);
10273 goto exit_on_error;
10318 ret = heap_attrinfo_recache (thread_p, reprid, attr_info);
10321 goto exit_on_error;
10332 value = &attr_info->
values[
i];
10333 ret = heap_attrvalue_read (
recdes, value, attr_info);
10336 goto exit_on_error;
10378 ret = heap_attrinfo_recache (thread_p, reprid, attr_info);
10381 goto exit_on_error;
10392 value = &attr_info->
values[
i];
10397 ret = heap_attrvalue_read (
recdes, value, attr_info);
10400 goto exit_on_error;
10443 fprintf (fp,
" Empty attrinfo\n");
10451 if (dump_schema ==
true)
10458 value = &attr_info->
values[
i];
10459 fprintf (fp,
" Attrid = %d, state = %d, type = %s\n", value->
attrid, value->
state,
10465 fprintf (fp,
" Memory_value_format:\n");
10466 fprintf (fp,
" value = ");
10468 fprintf (fp,
"\n\n");
10489 for (
i = 0, value = attr_info->
values; i < attr_info->num_values;
i++, value++)
10491 if (attrid == value->
attrid)
10512 for (
i = 0, value = attr_info->
values; i < attr_info->num_values;
i++, value++)
10514 if (attrid == value->
attrid)
10536 for (
i = 0, value = attr_info->
values; i < attr_info->num_values;
i++, value++)
10538 if (attrid == value->
attrid)
10596 heap_get_class_subclasses (
THREAD_ENTRY * thread_p,
const OID * class_oid,
int *count,
OID ** subclasses)
10635 HFID * class_hfid,
REPR_ID * repr_id,
int *has_partition_info)
10667 if (class_hfid !=
NULL)
10695 char *attr_name =
NULL;
10696 bool is_scan_cache_started =
false, is_attrinfo_started =
false;
10697 char *
string =
NULL;
10698 int alloced_string = 0;
10701 if (type_id ==
NULL || values_id ==
NULL)
10714 is_scan_cache_started =
true;
10721 is_attrinfo_started =
true;
10731 alloced_string = 0;
10741 attr_name = string;
10742 if (attr_name ==
NULL)
10747 if (strcmp (attr_name,
"ptype") == 0)
10752 if (strcmp (attr_name,
"pvalues") == 0)
10757 if (
string !=
NULL && alloced_string == 1)
10770 if (is_attrinfo_started)
10774 if (is_scan_cache_started)
10796 heap_get_partitions_from_subclasses (
THREAD_ENTRY * thread_p,
const OID * subclasses,
int *parts_count,
10799 int part_idx = 0,
i;
10803 int has_partition_info = 0;
10821 heap_class_get_partition_info (thread_p, &subclasses[
i], &parts[part_idx], &part_hfid, &repr_id,
10822 &has_partition_info);
10828 if (has_partition_info == 0)
10834 COPY_OID (&(parts[part_idx].class_oid), &subclasses[
i]);
10835 HFID_COPY (&(parts[part_idx].class_hfid), &part_hfid);
10836 parts[part_idx].
rep_id = repr_id;
10840 *parts_count = part_idx;
10846 for (
i = 1;
i < part_idx;
i++)
10848 if (parts[
i].values !=
NULL)
10868 int subclasses_count = 0;
10875 int has_partition_info = 0;
10885 heap_class_get_partition_info (thread_p, class_oid, &part_info, &class_hfid, &class_repr_id, &has_partition_info);
10891 if (has_partition_info == 0)
10899 error = heap_get_class_subclasses (thread_p, class_oid, &subclasses_count, &subclasses);
10904 else if (subclasses_count == 0)
10916 if (partitions ==
NULL)
10923 error = heap_get_partitions_from_subclasses (thread_p, subclasses, parts_count, partitions);
10931 COPY_OID (&partitions[0].class_oid, class_oid);
10932 HFID_COPY (&partitions[0].class_hfid, &class_hfid);
10934 partitions[0].
rep_id = class_repr_id;
10939 if (partitions[0].values ==
NULL)
10948 *parts = partitions;
10951 if (subclasses !=
NULL)
10982 for (
i = 0;
i < parts_count;
i++)
10984 if (parts[
i].values !=
NULL)
11040 if (inst_oid !=
NULL)
11053 goto exit_on_error;
11066 goto exit_on_error;
11105 ret = heap_attrinfo_check (inst_oid, attr_info);
11108 goto exit_on_error;
11114 goto exit_on_error;
11120 goto exit_on_error;
11126 goto exit_on_error;
11134 goto exit_on_error;
11167 goto exit_on_error;
11206 ret = heap_attrinfo_check (inst_oid, attr_info);
11209 goto exit_on_error;
11228 ret = heap_attrinfo_recache (thread_p, reprid, attr_info);
11231 goto exit_on_error;
11241 value = &attr_info->
values[
i];
11244 ret = heap_attrvalue_read (
recdes, value, attr_info);
11247 goto exit_on_error;
11258 ret = heap_attrvalue_read (
recdes, value, attr_info);
11261 goto exit_on_error;
11275 ret = (ret >= 0 ?
NO_ERROR : ret);
11278 goto exit_on_error;
11315 heap_attrinfo_get_disksize (
HEAP_CACHE_ATTRINFO * attr_info,
bool is_mvcc_class,
int *offset_size_ptr)
11326 value = &attr_info->
values[
i];
11380 return heap_attrinfo_transform_to_disk_internal (thread_p, attr_info, old_recdes, new_recdes,
LOB_FLAG_INCLUDE_LOB);
11400 return heap_attrinfo_transform_to_disk_internal (thread_p, attr_info, old_recdes, new_recdes,
LOB_FLAG_EXCLUDE_LOB);
11419 RECDES * new_recdes,
int lob_create_flag)
11422 char *ptr_bound, *ptr_varvals;
11426 unsigned int repid_bits;
11430 int expected_size, tmp;
11431 volatile int offset_size;
11432 int mvcc_wasted_space = 0, header_size;
11433 bool is_mvcc_class;
11444 if (heap_attrinfo_set_uninitialized (thread_p, &attr_info->
inst_oid, old_recdes, attr_info) !=
NO_ERROR)
11454 expected_size = heap_attrinfo_get_disksize (attr_info, is_mvcc_class, &tmp);
11460 if (old_recdes !=
NULL)
11469 expected_size += mvcc_wasted_space;
11471 switch (_setjmp (buf->
env))
11501 if (old_recdes ==
NULL)
11541 ptr_varvals = (ptr_bound
11548 if (ptr_varvals + mvcc_wasted_space >= buf->
endptr)
11550 new_recdes->
length = -expected_size;
11556 value = &attr_info->
values[
i];
11598 dbvalue = &temp_dbvalue;
11647 buf->
ptr = ptr_varvals;
11652 DB_ELO dest_elo, *elo_p;
11653 char *save_meta_data, *new_meta_data;
11666 || new_meta_data ==
NULL)
11698 ptr_varvals = buf->
ptr;
11721 if (ptr_varvals + mvcc_wasted_space < buf->endptr)
11740 new_recdes->
length = -expected_size;
11783 int num_found_attrs;
11785 int classrepr_cacheindex = -1;
11798 if (classrepr ==
NULL)
11811 if (set_attrids ==
NULL)
11821 set_attrids = guess_attrids;
11829 set_attrids[num_found_attrs++] = search_attrepr->
id;
11833 ret =
heap_attrinfo_start (thread_p, class_oid, num_found_attrs, set_attrids, attr_info);
11835 if (set_attrids != guess_attrids)
11859 int num_found_attrs;
11861 int classrepr_cacheindex = -1;
11874 set_attrids = guess_attrids;
11878 if (classrepr ==
NULL)
11886 if (set_attrids ==
NULL)
11896 set_attrids = guess_attrids;
11904 for (
j = 0;
j < *num_btids;
j++)
11907 if (indexp->
n_atts == 1)
11911 else if (indexp->
n_atts > 1)
11926 for (
i = 0, num_found_attrs = 0, search_attrepr = classrepr->
attributes; i < classrepr->n_attributes;
11927 i++, search_attrepr++)
11929 if (search_attrepr->
n_btids <= 0)
11936 for (
j = 0;
j < *num_btids;
j++)
11939 if (indexp->
n_atts == 1 && indexp->
atts[0]->
id == search_attrepr->
id)
11941 set_attrids[num_found_attrs++] = search_attrepr->
id;
11972 if (num_found_attrs <= 0)
11996 value = &attr_info->
values[
i];
11997 value->
attrid = set_attrids[
i];
12007 if (heap_attrinfo_recache_attrepr (attr_info,
true) !=
NO_ERROR)
12015 if (set_attrids != guess_attrids)
12026 return num_found_attrs;
12032 if (set_attrids != guess_attrids)
12101 int classrepr_cacheindex = -1;
12102 int num_found_attrs = 0;
12108 set_attrids = guess_attrids;
12116 if (classrepr ==
NULL)
12125 if (index_id == -1)
12141 if (set_attrids ==
NULL)
12148 for (
i = 0;
i < num_found_attrs;
i++)
12158 if (num_found_attrs > 0)
12169 if (set_attrids != guess_attrids)
12184 if (set_attrids != guess_attrids)
12192 #if defined (ENABLE_UNUSED_FUNCTION) 12203 heap_attrvalue_get_index (
int value_index,
ATTR_ID * attrid,
int *n_btids,
BTID ** btids,
12214 if (value_index > idx_attrinfo->
num_values || value_index < 0)
12223 value = &idx_attrinfo->
values[value_index];
12226 *attrid = value->
attrid;
12249 int num_atts,
i,
k;
12258 num_atts = index->
n_atts;
12259 atts = index->
atts;
12268 nullmap_ptr = midxkey->
buf;
12271 for (
i = 0;
i < num_atts &&
k < num_atts;
i++)
12283 if (key_domain !=
NULL)
12289 if (set_domain ==
NULL)
12294 next_domain = set_domain;
12304 next_domain = next_domain->
next;
12314 error = heap_midxkey_get_value (
recdes, atts[
i], &value, attrinfo);
12325 if (key_domain !=
NULL)
12331 if (set_domain ==
NULL)
12340 next_domain = set_domain;
12354 next_domain = next_domain->
next;
12364 if (key_domain !=
NULL)
12387 for (td = set_domain, next =
NULL; td !=
NULL; td = next)
12408 int func_attr_index_start)
12411 int num_vals,
i, reprid,
k;
12428 if (heap_attrinfo_recache (thread_p, reprid, attrinfo) !=
NO_ERROR)
12439 nullmap_ptr = midxkey->
buf;
12445 num_vals = func_attr_index_start + 1;
12449 for (
i = 0;
i < num_vals &&
k < num_vals;
i++)
12451 if (
i == func_col_id)
12465 att = heap_locate_attribute (att_ids[
i], attrinfo);
12467 error = heap_midxkey_get_value (
recdes, att, &value, attrinfo);
12528 int fi_attr_index_start = -1;
12529 int fi_col_id = -1;
12533 if (func_index_info)
12536 fi_col_id = func_index_info->
col_id;
12537 if (heap_eval_function_index (thread_p, func_index_info, n_atts, att_ids, attr_info,
recdes, -1, db_valuep,
12542 fi_res = db_valuep;
12549 if ((n_atts > 1 && func_index_info ==
NULL) || (func_index_info && (func_index_info->
attr_index_start + 1) > 1))
12554 if (func_index_info !=
NULL)
12575 if (heap_midxkey_key_generate (thread_p,
recdes, &midxkey, att_ids, attr_info, fi_res, fi_col_id,
12576 fi_attr_index_start) ==
NULL)
12590 ret_valp = db_valuep;
12598 if (func_index_info)
12600 ret_valp = db_valuep;
12605 if (ret_valp !=
NULL && atts_prefix_length && n_atts == 1)
12612 ret_valp = db_valuep;
12657 int n_atts, reprid;
12683 if (heap_attrinfo_recache (thread_p, reprid, idx_attrinfo) !=
NO_ERROR)
12698 func_indx_pred, &fi_domain) !=
NO_ERROR)
12739 if (heap_midxkey_key_get (
recdes, &midxkey, index, idx_attrinfo, fi_res, fi_domain, key_domain) ==
NULL)
12766 if (key_domain !=
NULL)
12785 if (key_domain !=
NULL)
12803 if (prefix_dom ==
NULL)
12806 if (prefix_dom !=
NULL)
12815 if (prefix_dom ==
NULL)
12843 if (btid_index != -1 && btid_index < attrinfo->last_classrepr->n_indexes)
12862 if (btid_index != -1 && btid_index < attrinfo->last_classrepr->n_indexes)
12885 if (btid_index != -1 && (btid_index < attrinfo->last_classrepr->n_indexes))
12905 int len_attrs_prefix_length)
12907 int i, length = -1;
12910 if (attrs_prefix_length && len_attrs_prefix_length > 0)
12912 for (
i = 0;
i < len_attrs_prefix_length;
i++)
12914 attrs_prefix_length[
i] = -1;
12918 if (btid_index != -1 && (btid_index < attrinfo->last_classrepr->n_indexes))
12923 for (
i = 0;
i < length;
i++)
12945 int idx_in_cache,
i;
12952 if (classrep ==
NULL)
12965 if (classrep !=
NULL)
12985 int *num_attrs,
ATTR_ID ** attr_ids,
int **attrs_prefix_length,
char **btnamepp,
12986 int *func_index_col_id)
12990 int idx_in_cache,
i,
n = 0;
13010 if (attrs_prefix_length)
13012 *attrs_prefix_length =
NULL;
13015 if (func_index_col_id)
13017 *func_index_col_id = -1;
13022 if (classrepp ==
NULL)
13024 goto exit_on_error;
13031 goto exit_on_error;
13033 indexp = &classrepp->
indexes[idx];
13044 *num_attrs =
n = indexp->
n_atts;
13051 if (*attr_ids ==
NULL)
13053 goto exit_on_error;
13057 for (
i = 0;
i <
n;
i++)
13059 (*attr_ids)[
i] = indexp->
atts[
i]->
id;
13072 if (*attrs_prefix_length ==
NULL)
13074 goto exit_on_error;
13077 for (
i = 0;
i <
n;
i++)
13085 (*attrs_prefix_length)[
i] = -1;
13102 if (attr_ids && *attr_ids)
13107 if (btnamepp && *btnamepp)
13112 if (attrs_prefix_length)
13114 if (*attrs_prefix_length)
13118 *attrs_prefix_length =
NULL;
13154 int *max_oid_cnt,
OID ** oid_list)
13176 if ((heap_attrinfo_start_refoids (thread_p, class_oid, &attr_info) !=
NO_ERROR)
13182 if (*oid_list ==
NULL)
13186 else if (*max_oid_cnt <= 0)
13200 oid_ptr = *oid_list;
13204 value = &attr_info.
values[
i];
13212 if (oid_cnt == *max_oid_cnt)
13218 if (*max_oid_cnt <= 0)
13225 new_max_oid = (
int) (*max_oid_cnt * 1.5) + 1;
13232 if (new_max_oid < 10)
13237 oid_ptr = (
OID *)
realloc (*oid_list, new_max_oid *
sizeof (
OID));
13238 if (oid_ptr ==
NULL)
13247 *oid_list = oid_ptr;
13248 oid_ptr += *max_oid_cnt;
13249 *max_oid_cnt = new_max_oid;
13251 *oid_ptr = *attr_oid;
13267 for (
j = 0;
j < cnt;
j++)
13278 if (oid_cnt == *max_oid_cnt)
13284 if (*max_oid_cnt <= 0)
13291 new_max_oid = (
int) (*max_oid_cnt * 1.5) + 1;
13297 if (new_max_oid < 10)
13302 oid_ptr = (
OID *)
realloc (*oid_list, new_max_oid *
sizeof (
OID));
13303 if (oid_ptr ==
NULL)
13306 new_max_oid *
sizeof (
OID));
13313 *oid_list = oid_ptr;
13314 oid_ptr += *max_oid_cnt;
13315 *max_oid_cnt = new_max_oid;
13317 *oid_ptr = *attr_oid;
13332 if (*oid_list !=
NULL)
13367 INT16 right_slotid, left_slotid;
13399 right_slotid = oid->
slotid;
13400 left_slotid = oid->
slotid;
13417 COPY_OID (&((*prefetch->
obj)->class_oid), class_oid);
13419 (*prefetch->
obj)->oid.pageid = oid->
pageid;
13420 (*prefetch->
obj)->oid.
slotid = right_slotid;
13426 *prefetch->
offset += round_length;
13445 COPY_OID (&((*prefetch->
obj)->class_oid), class_oid);
13447 (*prefetch->
obj)->oid.pageid = oid->
pageid;
13448 (*prefetch->
obj)->oid.
slotid = left_slotid;
13454 *prefetch->
offset += round_length;
13473 INT32 * num_checked)
13476 VPID *vpidptr_ofpgptr;
13479 bool spg_error =
false;
13536 if (chk_objs !=
NULL)
13538 valid_pg = heap_chkreloc_next (thread_p, chk_objs, pg_watcher.
pgptr);
13550 *num_checked = npages;
13551 return (spg_error ==
true) ?
DISK_ERROR : valid_pg;
13554 #if defined (SA_MODE) 13572 valid = heap_chkreloc_next (thread_p, chk_objs, *page);
13637 #if defined (SA_MODE) 13641 valid_pg = heap_chkreloc_start (chk_objs);
13652 valid_pg = heap_check_all_pages_by_heapchain (thread_p,
hfid, chk_objs, &npages);
13654 #if defined (SA_MODE) 13660 if (file_numpages != -1 && file_numpages != npages)
13665 if (chk_objs !=
NULL)
13667 chk_objs->
verify =
false;
13668 (void) heap_chkreloc_end (chk_objs);
13670 tmp_valid_pg = heap_chkreloc_start (chk_objs);
13677 tmp_valid_pg = heap_check_all_pages_by_file_table (thread_p,
hfid, chk_objs);
13679 if (chk_objs !=
NULL)
13683 tmp_valid_pg = heap_chkreloc_end (chk_objs);
13687 chk_objs->
verify =
false;
13688 (void) heap_chkreloc_end (chk_objs);
13692 if (npages != file_numpages)
13700 valid_pg = tmp_valid_pg;
13706 if (chk_objs !=
NULL)
13708 valid_pg = heap_chkreloc_end (chk_objs);
13752 #if defined(SA_MODE) 13796 #if !defined (NDEBUG) 13814 #if !defined (NDEBUG) 13863 goto exit_on_error;
13875 goto exit_on_error;
13914 fprintf (fp,
"unfill_space = %4d\n", heap_hdr->
unfill_space);
13915 fprintf (fp,
"Estimated: num_pages = %d, num_recs = %d, avg reclength = %d\n", heap_hdr->
estimates.
num_pages,
13917 fprintf (fp,
"Estimated: num high best = %d, num others(not in array) high best = %d\n",
13919 fprintf (fp,
"Hint of best set of vpids with head = %d\n", heap_hdr->
estimates.
head);
13923 if (
j != 0 &&
j % 5 == 0)
13925 fprintf (fp,
"\n");
13930 fprintf (fp,
"\n");
13932 fprintf (fp,
"Second best: num hints = %d, head of hints = %d, tail (next to insert) of hints = %d, num subs = %d\n",
13937 if (
j != 0 &&
j % 5 == 0)
13939 fprintf (fp,
"\n");
13943 fprintf (fp,
"\n");
13982 fprintf (fp,
"\n\n*** DUMPING HEAP FILE: ");
14007 ret = heap_dump_hdr (fp, heap_hdr);
14054 fprintf (fp,
"\nOVERFLOW FILE INFORMATION FOR HEAP FILE\n\n");
14087 if (dump_records ==
true)
14101 fprintf (fp,
"Object-OID = %2d|%4d|%2d,\n Length on disk = %d,\n", oid.
volid, oid.
pageid, oid.
slotid,
14106 fprintf (fp,
" Error ... continue\n");
14120 fprintf (fp,
"\n\n*** END OF DUMP FOR HEAP FILE ***\n\n");
14134 INT64 num_recs = 0;
14135 INT64 num_recs_relocated = 0;
14136 INT64 num_recs_inovf = 0;
14137 INT64 num_pages = 0;
14138 int avg_freespace = 0;
14139 int avg_freespace_nolast = 0;
14140 int avg_reclength = 0;
14141 int avg_overhead = 0;
14152 heap_get_capacity (thread_p,
hfid, &num_recs, &num_recs_relocated, &num_recs_inovf, &num_pages, &avg_freespace,
14153 &avg_freespace_nolast, &avg_reclength, &avg_overhead);
14159 fprintf (fp,
"HFID:%d|%d|%d, Num_recs = %" PRId64
", Num_reloc_recs = %" PRId64
",\n Num_recs_inovf = %" PRId64
14160 ", Avg_reclength = %d,\n Num_pages = %" PRId64
", Avg_free_space_per_page = %d,\n" 14161 " Avg_free_space_per_page_without_lastpage = %d\n Avg_overhead_per_page = %d\n",
14163 avg_reclength, num_pages, avg_freespace, avg_freespace_nolast, avg_overhead);
14189 fprintf (fp,
"\n");
14276 if (chk->
verify ==
true)
14281 if (forward !=
NULL)
14304 #if defined (SA_MODE) 14321 (void)
mht_map (chk->
ht, heap_chkreloc_print_notfound, chk);
14322 #if defined (SA_MODE) 14330 return valid_reloc;
14344 heap_chkreloc_print_notfound (
const void *ignore_reloc_oid,
void *ent,
void *xchk)
14349 if (chk->
verify ==
true)
14352 "Unable to find relocated record with oid=%d|%d|%d for home object with oid=%d|%d|%d\n",
14355 #if defined (SA_MODE) 14391 #define HEAP_CHKRELOC_UNFOUND_SHORT 5 14399 OID oid, class_oid;
14405 if (chk->
verify !=
true)
14463 if (found ==
false)
14469 if (forward ==
NULL)
14496 VPID overflow_vpid;
14512 if (overflow_page ==
NULL)
14589 if (forward !=
NULL)
14671 heap_chnguess_initialize (
void)
14677 if (heap_Guesschn !=
NULL)
14679 ret = heap_chnguess_finalize ();
14682 goto exit_on_error;
14705 heap_Guesschn_area.
ht =
14707 if (heap_Guesschn_area.
ht ==
NULL)
14709 goto exit_on_error;
14719 goto exit_on_error;
14730 goto exit_on_error;
14738 entry = &heap_Guesschn_area.
entries[
i];
14746 heap_Guesschn = &heap_Guesschn_area;
14763 heap_chnguess_realloc (
void)
14766 unsigned char *save_bitindex;
14771 if (heap_Guesschn ==
NULL)
14773 return heap_chnguess_initialize ();
14779 save_bitindex = heap_Guesschn_area.
bitindex;
14780 save_nbytes = heap_Guesschn_area.
nbytes;
14806 heap_Guesschn_area.
bitindex = save_bitindex;
14807 heap_Guesschn_area.
nbytes = save_nbytes;
14809 goto exit_on_error;
14818 entry = &heap_Guesschn_area.
entries[
i];
14823 memcpy (entry->
bits, &save_bitindex[
i * save_nbytes], save_nbytes);
14845 heap_chnguess_finalize (
void)
14849 if (heap_Guesschn ==
NULL)
14857 heap_Guesschn->
ht =
NULL;
14862 heap_Guesschn->
nbytes = 0;
14864 heap_Guesschn =
NULL;
14874 heap_stats_bestspace_initialize (
void)
14878 if (heap_Bestspace !=
NULL)
14880 ret = heap_stats_bestspace_finalize ();
14883 goto exit_on_error;
14887 heap_Bestspace = &heap_Bestspace_cache_area;
14897 goto exit_on_error;
14904 goto exit_on_error;
14926 heap_stats_bestspace_finalize (
void)
14931 if (heap_Bestspace ==
NULL)
14968 heap_Bestspace =
NULL;
14985 heap_chnguess_decache (
const OID * oid)
14990 if (heap_Guesschn ==
NULL)
14997 (void)
mht_map (heap_Guesschn->
ht, heap_chnguess_remove_entry,
NULL);
15004 (void) heap_chnguess_remove_entry (oid, entry,
NULL);
15027 heap_chnguess_remove_entry (
const void *oid_key,
void *ent,
void *xignore)
15042 #if defined (CUBRID_DEBUG) 15050 heap_chnguess_dump (FILE * fp)
15052 int max_tranindex, tran_index,
i;
15055 if (heap_Guesschn !=
NULL)
15057 fprintf (fp,
"*** Dump of CLASS_OID to CHNGUESS at clients *** \n");
15058 fprintf (fp,
"Schema_change = %d, clock_hand = %d,\n", heap_Guesschn->
schema_change, heap_Guesschn->
clock_hand);
15059 fprintf (fp,
"Nentries = %d, Nactive_entries = %u, maxnum of clients = %d, nbytes = %d\n",
15062 fprintf (fp,
"Hash Table = %p, Entries = %p, Bitindex = %p\n", heap_Guesschn->
ht, heap_Guesschn->
entries,
15068 entry = &heap_Guesschn_area.
entries[
i];
15072 fprintf (fp,
" \nEntry_id %d", entry->
idx);
15073 fprintf (fp,
"OID = %2d|%4d|%2d, chn = %d, recently_free = %d,", entry->
oid.
volid, entry->
oid.
pageid,
15077 for (tran_index = 0; tran_index < max_tranindex; tran_index++)
15079 if (tran_index % 40 == 0)
15081 fprintf (fp,
"\n ");
15083 else if (tran_index % 10 == 0)
15089 fprintf (fp,
"\n");
15116 if (heap_Guesschn !=
NULL)
15120 if (heap_chnguess_realloc () !=
NO_ERROR)
15163 if (heap_Guesschn ==
NULL)
15175 if (heap_chnguess_realloc () !=
NO_ERROR)
15191 if (entry->
chn != chn)
15203 can_continue =
true;
15204 while (entry ==
NULL && can_continue ==
true)
15206 can_continue =
false;
15227 can_continue =
true;
15277 if (heap_Guesschn !=
NULL)
15281 entry = &heap_Guesschn_area.
entries[
i];
15391 ret = heap_dump_hdr (fp, heap_hdr);
15406 fprintf (fp,
"CLASS_OID = %2d|%4d|%2d, PREV_VPID = %2d|%4d, NEXT_VPID = %2d|%4d, MAX_MVCCID=%llu, flags=%d.\n",
15472 #define HEAP_LOG_MVCC_INSERT_MAX_REDO_CRUMBS 4 15474 int n_redo_crumbs = 0, data_copy_offset = 0, chn_offset;
15494 redo_crumbs[n_redo_crumbs].
length =
sizeof (p_recdes->
type);
15495 redo_crumbs[n_redo_crumbs++].
data = &p_recdes->
type;
15504 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data;
15508 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data + chn_offset;
15515 redo_crumbs[n_redo_crumbs].
length = p_recdes->
length - data_copy_offset;
15516 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data + data_copy_offset;
15538 int chn, sp_success;
15541 bool vacuum_status_change =
false;
15549 vacuum_status_change =
true;
15554 record_type = *(INT16 *) rcv->
data;
15559 rcv->
data + sizeof (record_type));
15564 int repid_and_flags,
offset, mvcc_flag, offset_size;
15566 offset =
sizeof (record_type);
15613 heap_page_rv_chain_update (thread_p, rcv->
pgptr, rcv->
mvcc_id, vacuum_status_change);
15677 int redo_data_size = 0;
15706 assert ((
ptr - redo_data_buffer) <= (
int)
sizeof (redo_data_buffer));
15871 bool vacuum_status_change =
false;
15879 vacuum_status_change =
true;
15886 error_code = heap_rv_mvcc_redo_delete_internal (thread_p, rcv->
pgptr, slotid, rcv->
mvcc_id);
15892 heap_page_rv_chain_update (thread_p, rcv->
pgptr, rcv->
mvcc_id, vacuum_status_change);
15963 error_code = heap_rv_mvcc_redo_delete_internal (thread_p, rcv->
pgptr, rcv->
offset, mvccid);
16015 recdes_type = *(INT16 *) (rcv->
data);
16050 recdes_type = *(INT16 *) (rcv->
data);
16127 const bool is_header_page = ((rcv->
offset != 0) ?
true :
false);
16136 (void) heap_delete_all_page_records (thread_p, &
vpid, rcv->
pgptr);
16139 if (!is_header_page)
16178 const bool is_header_page = ((rcv->
offset != 0) ?
true :
false);
16180 (void) heap_reinitialize_page (thread_p, rcv->
pgptr, is_header_page);
16185 if (!is_header_page)
16222 fprintf (fp,
"Delete all objects in page for reuse purposes of page\n");
16277 if (has_visible_instance)
16318 int idx_incache = -1;
16320 if (!class_oid || !idx_incache)
16348 int i, idx_in_cache;
16349 char *classname =
NULL;
16350 char *attr_name =
NULL;
16354 DB_VALUE dbvalue_numeric, *dbvalue, key_val;
16356 OID serial_class_oid;
16362 bool use_local_scan_cache =
false;
16364 int alloced_string = 0;
16365 char *
string =
NULL;
16367 if (!attr_info || !scan_cache)
16379 value = &attr_info->
values[
i];
16387 memset (serial_name,
'\0',
sizeof (serial_name));
16393 scan_cache = &local_scan_cache;
16395 use_local_scan_cache =
true;
16401 goto exit_on_error;
16407 goto exit_on_error;
16411 alloced_string = 0;
16417 goto exit_on_error;
16420 attr_name = string;
16421 if (attr_name ==
NULL)
16424 goto exit_on_error;
16429 if (
string !=
NULL && alloced_string == 1)
16440 goto exit_on_error;
16447 goto exit_on_error;
16451 if (classrep ==
NULL)
16454 goto exit_on_error;
16470 goto exit_on_error;
16475 *(
INT64 *) (&serial_oid));
16481 goto exit_on_error;
16492 goto exit_on_error;
16498 goto exit_on_error;
16508 goto exit_on_error;
16517 if (use_local_scan_cache)
16525 if (classname !=
NULL)
16530 if (use_local_scan_cache)
16548 if (attr_info ==
NULL)
16553 return heap_attrinfo_set_uninitialized (thread_p, inst_oid,
recdes, attr_info);
16567 error_code = heap_hfid_cache_get (thread_p, class_oid,
hfid,
NULL);
16592 error_code = heap_hfid_cache_get (thread_p, class_oid, hfid_out, ftype_out);
16618 if (class_oid ==
NULL)
16649 goto exit_on_error;
16660 goto exit_on_error;
16676 goto exit_on_error;
16683 goto exit_on_error;
16690 goto exit_on_error;
16735 bool need_free_classname =
false;
16739 classname = (
char *)
"unknown";
16744 need_free_classname =
true;
16752 fprintf (fp,
"*** Dumping representations of class %s\n Classname = %s, Class-OID = %d|%d|%d, #Repr = %d\n",
16753 classname, classname, (
int) class_oid->
volid, class_oid->
pageid, (
int) class_oid->
slotid, count);
16755 for (
i = 0;
i < count;
i++)
16758 heap_classrepr_dump (thread_p, fp, class_oid, rep_all[
i]);
16762 fprintf (fp,
"\n*** End of dump.\n");
16768 if (need_free_classname)
16793 BTID * p_found_btid)
16796 int classrepr_cacheindex = -1;
16812 if (classrepr ==
NULL)
16824 for (idx_cnt = 0, curr_index = classrepr->
indexes; idx_cnt < classrepr->n_indexes; idx_cnt++, curr_index++)
16826 if (curr_index ==
NULL)
16870 int force_count = 0, updated_n_attrs_id = 0;
16876 if (upd_scancache ==
NULL || attr_info ==
NULL || oid ==
NULL)
16883 for (
i = 0, value = attr_info->
values; i < attr_info->num_values;
i++, value++)
16886 bool log_warning =
false;
16895 if (att_id != value->
attrid)
16935 if (dest_prec < curr_prec)
16946 log_warning =
true;
16982 bool set_default_value =
false;
16983 bool set_min_value =
false;
16984 bool set_max_value =
false;
16995 int is_positive = -1;
17038 is_positive = ((
p < str_end && (*p) ==
'-') ? 0 : 1);
17047 if (is_positive == 1)
17049 set_max_value =
true;
17051 else if (is_positive == 0)
17053 set_min_value =
true;
17057 set_default_value =
true;
17062 set_default_value =
true;
17067 log_warning =
true;
17086 else if (set_min_value)
17101 assert (set_default_value ==
true);
17143 atts_id[updated_n_attrs_id] = value->
attrid;
17144 updated_n_attrs_id++;
17150 assert (updated_n_attrs_id == 1);
17204 char *expr_stream =
NULL;
17205 int expr_stream_size = 0;
17207 void *unpack_info =
NULL;
17211 bool atts_free =
false, attrinfo_clear =
false, attrinfo_end =
false;
17214 if (func_index_info ==
NULL && btid_index > -1 && n_atts == -1)
17217 if (func_pred_cache)
17221 nr_atts = index->
n_atts;
17227 nr_atts = index->
n_atts;
17236 for (
i = 0;
i < nr_atts;
i++)
17240 cache_attr_info = attr_info;
17250 cache_attr_info = ((
FUNC_PRED *) func_index_info->
expr)->cache_attrinfo;
17254 if (func_index_info ==
NULL)
17272 attrinfo_end =
true;
17280 attrinfo_clear =
true;
17291 if (fi_domain !=
NULL)
17302 if (attrinfo_clear && cache_attr_info)
17306 if (attrinfo_end && cache_attr_info)
17310 if (atts_free && atts)
17343 int *att_ids =
NULL;
17347 int *attr_info_started =
NULL;
17350 if (attr_info ==
NULL || class_oid ==
NULL || func_indx_preds ==
NULL)
17355 *func_indx_preds =
NULL;
17358 for (
i = 0;
i < n_indexes;
i++)
17364 if (fi_preds ==
NULL)
17374 for (
j = 0;
j < n_indexes;
j++)
17380 size = n_indexes *
sizeof (
int);
17382 if (attr_info_started ==
NULL)
17388 for (
j = 0;
j < n_indexes;
j++)
17390 attr_info_started[
j] = 0;
17422 attr_info_started[
i] = 1;
17431 if (attr_info_started !=
NULL)
17436 *func_indx_preds = fi_preds;
17446 if (attr_info_started !=
NULL)
17451 return error_status;
17466 int *attr_info_started)
17470 if (func_indx_preds ==
NULL)
17475 for (
i = 0;
i < n_indexes;
i++)
17479 if (attr_info_started ==
NULL || attr_info_started[
i])
17487 if (func_indx_preds[
i].unpack_info)
17511 char *class_name =
NULL;
17518 int parts_count = 0;
17519 bool is_all =
false;
17566 for (
i = 0;
i < parts_count;
i++)
17637 char *class_name =
NULL;
17638 int avg_length = 0;
17639 char buf[512] = { 0 };
17640 char temp[64] = { 0 };
17752 end = buf +
sizeof (buf);
17757 if (fill_string_to_buffer (&buf_p,
end,
", ") == -1)
17763 heap_bestspace_to_string (temp,
sizeof (temp), heap_hdr->
estimates.
best +
i);
17764 if (fill_string_to_buffer (&buf_p,
end, temp) == -1)
17791 end = buf +
sizeof (buf);
17796 if (fill_string_to_buffer (&buf_p,
end,
", ") == -1)
17803 if (fill_string_to_buffer (&buf_p,
end, temp) == -1)
17832 assert (idx == out_cnt);
17841 if (class_name !=
NULL)
17867 char *classname =
NULL;
17868 char class_oid_str[64] = { 0 };
17869 bool is_heap_attrinfo_started =
false;
17870 INT64 num_recs = 0;
17871 INT64 num_relocated_recs = 0;
17872 INT64 num_overflowed_recs = 0;
17873 INT64 num_pages = 0;
17874 int avg_rec_len = 0;
17875 int avg_free_space_per_page = 0;
17876 int avg_free_space_without_last_page = 0;
17877 int avg_overhead_per_page = 0;
17892 heap_get_capacity (thread_p, hfid_p, &num_recs, &num_relocated_recs, &num_overflowed_recs, &num_pages,
17893 &avg_free_space_per_page, &avg_free_space_without_last_page, &avg_rec_len,
17894 &avg_overhead_per_page);
17913 is_heap_attrinfo_started =
true;
17971 db_make_int (out_values[idx], avg_free_space_per_page);
17974 db_make_int (out_values[idx], avg_free_space_without_last_page);
17977 db_make_int (out_values[idx], avg_overhead_per_page);
18002 assert (idx == out_cnt);
18006 if (classname !=
NULL)
18011 if (is_heap_attrinfo_started)
18050 heap_bestspace_to_string (
char *buf,
int buf_size,
const HEAP_BESTSPACE * hb)
18053 buf[buf_size - 1] =
'\0';
18075 fill_string_to_buffer (
char **
start,
char *
end,
const char *str)
18108 if (page_info ==
NULL)
18199 scan = heap_get_page_info (thread_p, class_oid,
hfid, next_vpid, pg_watcher.
pgptr, cache_pageinfo);
18269 scan = heap_get_page_info (thread_p, class_oid,
hfid, prev_vpid, pg_watcher.
pgptr, cache_pageinfo);
18311 if (slot_p ==
NULL)
18507 return heap_next_internal (thread_p,
hfid, class_oid, next_oid,
recdes, scan_cache, ispeeking,
false,
NULL);
18533 return heap_next_internal (thread_p,
hfid, class_oid, next_oid,
recdes, scan_cache, ispeeking,
false,
18556 return heap_next_internal (thread_p,
hfid, class_oid, next_oid,
recdes, scan_cache, ispeeking,
true,
NULL);
18582 return heap_next_internal (thread_p,
hfid, class_oid, next_oid,
recdes, scan_cache, ispeeking,
true,
18616 new_scan_cache->
area = old_scan_cache->
area;
18622 VPID *vpidptr_incache;
18659 if (peek_recdes ==
NULL)
18661 peek_recdes = &ovf_recdes;
18876 bool vacuum_status_change =
false;
18885 vacuum_status_change =
true;
18897 heap_page_rv_chain_update (thread_p, rcv->
pgptr, rcv->
mvcc_id, vacuum_status_change);
18916 int num_btids,
i,
j,
k;
18918 if (attr_info ==
NULL || att_id ==
NULL)
18924 for (
i = 0;
i < num_btids;
i++)
18929 for (
j = 0;
j < n_att_id;
j++)
18945 #if defined(ENABLE_UNUSED_FUNCTION) 18970 if (*hdr_pgptr_p !=
NULL)
18977 if (*hdr_pgptr_p ==
NULL)
18990 if (*home_pgptr_p ==
NULL)
18993 if ((*again_count_p)++ >= again_max)
19033 const OID * oid_p,
PAGE_PTR * fwd_pgptr_p,
const VPID * fwd_vpid_p,
const OID * fwd_oid_p,
19039 if (*fwd_pgptr_p !=
NULL)
19046 if (*fwd_pgptr_p ==
NULL)
19059 if (*home_pgptr_p ==
NULL)
19062 if ((*again_count_p)++ >= again_max)
19103 heap_try_fetch_header_with_forward_page (
THREAD_ENTRY * thread_p,
PAGE_PTR * home_pgptr_p,
const VPID * home_vpid_p,
19105 PAGE_PTR * fwd_pgptr_p,
const VPID * fwd_vpid_p,
const OID * fwd_oid_p,
19111 if (*hdr_pgptr_p !=
NULL)
19119 if (*hdr_pgptr_p ==
NULL)
19132 if (*home_pgptr_p ==
NULL)
19135 if ((*again_count_p)++ >= again_max)
19155 if (*fwd_pgptr_p ==
NULL)
19159 if ((*again_count_p)++ >= again_max)
19215 (void) heap_scancache_quick_start_internal (scan_cache, &root_hfid);
19266 (void) heap_scancache_quick_start_internal (scan_cache,
hfid);
19293 (void) heap_scancache_quick_start_internal (scan_cache, &class_hfid);
19376 heap_link_watchers (context, context);
19416 heap_mark_class_as_modified (
THREAD_ENTRY * thread_p,
OID * oid_p,
int chn,
bool decache)
19418 char *classname =
NULL;
19449 (void) heap_chnguess_decache (oid_p);
19588 if (forward_oid_hint ==
NULL)
19598 COPY_OID (&forward_oid, forward_oid_hint);
19618 #if defined(CUBRID_DEBUG) 19639 heap_build_forwarding_recdes (
RECDES * recdes_p, INT16 rec_type,
OID * forward_oid)
19644 recdes_p->
type = rec_type;
19645 recdes_p->
data = (
char *) forward_oid;
19667 int repid_and_flag_bits = 0, mvcc_flags = 0;
19668 char *new_ins_mvccid_pos_p, *start_p, *existing_data_p;
19670 bool use_optimization =
false;
19681 #if defined (SERVER_MODE) 19688 if (use_optimization)
19709 existing_data_p = new_ins_mvccid_pos_p;
19710 memmove (new_ins_mvccid_pos_p +
OR_MVCCID_SIZE, existing_data_p,
19729 #if defined (SERVER_MODE) 19746 int curr_header_size, new_header_size;
19754 record_size -= (curr_header_size - new_header_size);
19798 int repid_and_flag_bits = 0, mvcc_flags = 0, update_mvcc_flags;
19799 char *start_p, *new_ins_mvccid_pos_p, *existing_data_p, *new_data_p;
19801 bool use_optimization =
false;
19803 bool is_mvcc_op =
false;
19816 #if defined (SERVER_MODE) 19820 if (use_optimization)
19834 if ((mvcc_flags & update_mvcc_flags) != update_mvcc_flags)
19837 existing_data_p = new_ins_mvccid_pos_p;
19856 assert (existing_data_p < new_data_p);
19859 memmove (new_data_p, existing_data_p,
19884 #if defined (SERVER_MODE) 19901 int curr_header_size, new_header_size;
19909 record_size -= (curr_header_size - new_header_size);
19913 #if defined (SERVER_MODE) 20006 int slot_count, slot_id, lk_result;
20015 if (home_hint_p ==
NULL)
20063 for (slot_id = 0; slot_id <= slot_count; slot_id++)
20082 #if !defined(NDEBUG) 20138 #if defined(CUBRID_DEBUG) 20142 "heap_insert_internal: This function does not accept" 20143 " objects longer than %d. An object of %d was given\n", heap_Maxslotted_reclength,
recdes->
length);
20155 #if !defined(NDEBUG) 20158 OID heap_class_oid;
20223 error_code = heap_find_location_and_insert_rec_newhome (thread_p, &ins_context);
20242 if (out_oid_p !=
NULL)
20250 if (newhome_pg_watcher !=
NULL)
20257 heap_unfix_watchers (thread_p, &ins_context);
20285 #if defined(CUBRID_DEBUG) 20290 "heap_insert_internal: This function does not accept" 20291 " objects longer than %d. An object of %d was given\n", heap_Maxslotted_reclength,
recdes->
length);
20298 OID heap_class_oid;
20333 bool is_mvcc_op,
bool is_redistribute_op)
20338 log_addr.
vfid = vfid_p;
20340 log_addr.
pgptr = page_p;
20344 if (is_redistribute_op)
20348 heap_mvcc_log_redistribute (thread_p, recdes_p, &log_addr);
20353 heap_mvcc_log_insert (thread_p, recdes_p, &log_addr);
20358 INT16 bytes_reserved;
20364 temp_recdes.
type = recdes_p->
type;
20365 temp_recdes.
area_size =
sizeof (bytes_reserved);
20366 temp_recdes.
length =
sizeof (bytes_reserved);
20367 bytes_reserved = (INT16) recdes_p->
length;
20368 temp_recdes.
data = (
char *) &bytes_reserved;
20393 heap_delete_adjust_header (
MVCC_REC_HEADER * header_p,
MVCCID mvcc_id,
bool need_mvcc_header_max_size)
20400 if (need_mvcc_header_max_size)
20467 #if !defined(NDEBUG) 20470 OID heap_class_oid;
20515 VPID overflow_vpid;
20556 heap_delete_adjust_header (&overflow_header, mvcc_id,
false);
20575 heap_mvcc_log_home_no_change (thread_p, &log_addr);
20585 bool is_reusable = heap_is_reusable_oid (context->
file_type);
20588 rc = heap_fix_header_page (thread_p, context);
20666 if (heap_fix_forward_page (thread_p, context, &forward_oid) !=
NO_ERROR)
20682 RECDES new_forward_recdes, new_home_recdes;
20686 OID new_forward_oid;
20688 bool fits_in_home, fits_in_forward;
20689 bool update_old_home =
false;
20690 bool update_old_forward =
false;
20691 bool remove_old_forward =
false;
20692 bool is_adjusted_size_big =
false;
20693 int delid_offset, repid_and_flag_bits, mvcc_flags;
20694 char *build_recdes_data;
20695 bool use_optimization;
20699 adjusted_size = forward_recdes.
length;
20706 use_optimization =
true;
20711 if (is_adjusted_size_big)
20714 use_optimization =
false;
20720 is_adjusted_size_big =
false;
20721 use_optimization =
false;
20724 #if !defined(NDEBUG) 20725 if (is_adjusted_size_big)
20737 if (is_adjusted_size_big || (!fits_in_forward && !fits_in_home))
20740 rc = heap_fix_header_page (thread_p, context);
20762 use_optimization =
false;
20764 #if !defined(NDEBUG) 20765 if (is_adjusted_size_big)
20779 if (use_optimization)
20784 build_recdes_data = start_p = new_forward_recdes.
data;
20787 memcpy (build_recdes_data, forward_recdes.
data, delid_offset);
20788 build_recdes_data += delid_offset;
20799 #if !defined(NDEBUG) 20812 memcpy (build_recdes_data, forward_recdes.
data + delid_offset, forward_recdes.
length - delid_offset);
20813 new_forward_recdes.
length = adjusted_size;
20817 int forward_rec_header_size;
20827 heap_delete_adjust_header (&forward_rec_header, mvcc_id, is_adjusted_size_big);
20832 memcpy (new_forward_recdes.
data + new_forward_recdes.
length, forward_recdes.
data + forward_rec_header_size,
20833 forward_recdes.
length - forward_rec_header_size);
20834 new_forward_recdes.
length += forward_recdes.
length - forward_rec_header_size;
20839 if (is_adjusted_size_big)
20842 if (heap_ovf_insert (thread_p, &context->
hfid, &new_forward_oid, &new_forward_recdes) ==
NULL)
20848 heap_build_forwarding_recdes (&new_home_recdes,
REC_BIGONE, &new_forward_oid);
20851 remove_old_forward =
true;
20852 update_old_home =
true;
20856 else if (fits_in_home)
20859 new_home_recdes = new_forward_recdes;
20864 new_forward_recdes.
length = 0;
20869 remove_old_forward =
true;
20870 update_old_home =
true;
20874 else if (fits_in_forward)
20880 update_old_forward =
true;
20889 rc = heap_insert_newhome (thread_p, context, &new_forward_recdes, &new_forward_oid,
NULL);
20896 heap_build_forwarding_recdes (&new_home_recdes,
REC_RELOCATION, &new_forward_oid);
20899 remove_old_forward =
true;
20900 update_old_home =
true;
20910 if (update_old_home)
20935 heap_mvcc_log_home_change_on_delete (thread_p, &context->
home_recdes, &new_home_recdes, &home_addr);
20959 heap_mvcc_log_home_no_change (thread_p, &home_addr);
20968 if (update_old_forward)
20983 &new_forward_recdes);
20995 if (remove_old_forward)
21016 if (heap_is_reusable_oid (context->
file_type))
21035 bool is_reusable = heap_is_reusable_oid (context->
file_type);
21091 &forward_recdes,
true,
NULL);
21152 RECDES forwarding_recdes;
21153 RECDES *home_page_updated_recdes;
21158 bool is_adjusted_size_big =
false;
21159 int delid_offset, repid_and_flag_bits, mvcc_flags;
21160 char *build_recdes_data;
21161 bool use_optimization;
21169 use_optimization =
true;
21174 if (is_adjusted_size_big)
21177 use_optimization =
false;
21183 is_adjusted_size_big =
false;
21184 use_optimization =
false;
21187 #if !defined(NDEBUG) 21188 if (is_adjusted_size_big)
21198 if (use_optimization)
21204 build_recdes_data = start_p = built_recdes.
data;
21208 build_recdes_data += delid_offset;
21219 #if !defined(NDEBUG) 21234 built_recdes.
length = adjusted_size;
21251 heap_delete_adjust_header (&record_header, mvcc_id, is_adjusted_size_big);
21262 if (is_adjusted_size_big)
21291 if (heap_ovf_insert (thread_p, &context->
hfid, &forward_oid, &built_recdes) ==
NULL)
21305 error_code = heap_insert_newhome (thread_p, context, &built_recdes, &forward_oid,
NULL);
21316 heap_build_forwarding_recdes (&forwarding_recdes, forwarding_recdes.
type, &forward_oid);
21341 heap_mvcc_log_home_change_on_delete (thread_p, &context->
home_recdes, &forwarding_recdes, &rec_address);
21346 home_page_updated_recdes = &forwarding_recdes;
21364 home_page_updated_recdes = &built_recdes;
21372 home_page_updated_recdes);
21383 bool is_reusable = heap_is_reusable_oid (context->
file_type);
21457 bool mark_reusable,
LOG_LSA * undo_lsa)
21469 log_addr.
pgptr = page_p;
21470 log_addr.
vfid = vfid_p;
21476 INT16 bytes_reserved;
21478 temp_recdes.
type = recdes_p->
type;
21479 temp_recdes.
area_size =
sizeof (bytes_reserved);
21480 temp_recdes.
length =
sizeof (bytes_reserved);
21481 bytes_reserved = (INT16) recdes_p->
length;
21482 temp_recdes.
data = (
char *) &bytes_reserved;
21515 bool is_old_home_updated;
21529 error_code = heap_fix_header_page (thread_p, context);
21556 if (first_pgptr ==
NULL)
21576 is_old_home_updated =
false;
21592 heap_mvcc_log_home_no_change (thread_p, &log_addr);
21603 is_old_home_updated =
true;
21612 new_home_recdes = *context->
recdes_p;
21625 error_code = heap_insert_newhome (thread_p, context, context->
recdes_p, &newhome_oid,
NULL);
21633 heap_build_forwarding_recdes (&new_home_recdes,
REC_RELOCATION, &newhome_oid);
21643 is_old_home_updated =
true;
21648 if (is_old_home_updated)
21690 OID new_forward_oid;
21691 bool fits_in_home, fits_in_forward;
21692 bool update_old_home =
false;
21693 bool update_old_forward =
false;
21694 bool remove_old_forward =
false;
21710 rc = heap_fix_forward_page (thread_p, context, &forward_oid);
21726 rc = heap_fix_header_page (thread_p, context);
21751 if (heap_ovf_insert (thread_p, &context->
hfid, &new_forward_oid, context->
recdes_p) ==
NULL)
21758 heap_build_forwarding_recdes (&new_home_recdes,
REC_BIGONE, &new_forward_oid);
21761 remove_old_forward =
true;
21762 update_old_home =
true;
21766 else if (!fits_in_forward && !fits_in_home)
21773 newhome_pg_watcher_p = &newhome_pg_watcher;
21779 rc = heap_insert_newhome (thread_p, context, context->
recdes_p, &new_forward_oid, newhome_pg_watcher_p);
21787 heap_build_forwarding_recdes (&new_home_recdes,
REC_RELOCATION, &new_forward_oid);
21790 remove_old_forward =
true;
21791 update_old_home =
true;
21795 else if (fits_in_home)
21799 new_home_recdes = *context->
recdes_p;
21802 remove_old_forward =
true;
21803 update_old_home =
true;
21807 else if (fits_in_forward)
21813 update_old_forward =
true;
21826 assert (remove_old_forward != update_old_forward);
21828 assert (remove_old_forward == update_old_home);
21833 if (update_old_home)
21854 if (remove_old_forward)
21877 &forward_recdes,
true, &prev_version_lsa);
21893 if (update_old_forward)
21909 heap_mvcc_log_home_no_change (thread_p, &p_addr);
21934 &prev_version_lsa);
21948 if (newhome_pg_watcher_p !=
NULL && newhome_pg_watcher_p->
pgptr !=
NULL)
21967 RECDES forwarding_recdes;
21986 #if defined(CUBRID_DEBUG) 21988 "heap_update_home: ** SYSTEM_ERROR ** update" 21989 " mvcc update was attempted on REC_ASSIGN_ADDRESS home record");
21995 #if defined (SERVER_MODE) 22014 error_code = heap_fix_header_page (thread_p, context);
22023 if (heap_ovf_insert (thread_p, &context->
hfid, &forward_oid, context->
recdes_p) ==
NULL)
22030 heap_build_forwarding_recdes (&forwarding_recdes,
REC_BIGONE, &forward_oid);
22033 home_page_updated_recdes_p = &forwarding_recdes;
22045 newhome_pg_watcher_p = &newhome_pg_watcher;
22050 error_code = heap_fix_header_page (thread_p, context);
22060 error_code = heap_insert_newhome (thread_p, context, context->
recdes_p, &forward_oid, newhome_pg_watcher_p);
22068 heap_build_forwarding_recdes (&forwarding_recdes,
REC_RELOCATION, &forward_oid);
22071 home_page_updated_recdes_p = &forwarding_recdes;
22080 home_page_updated_recdes_p = context->
recdes_p;
22108 &context->
home_recdes, home_page_updated_recdes_p, undo_rcvindex);
22116 home_page_updated_recdes_p);
22128 newhome_pg_watcher_p, &prev_version_lsa);
22145 if (newhome_pg_watcher_p !=
NULL && newhome_pg_watcher_p->
pgptr !=
NULL)
22166 INT16 old_record_type;
22177 scancode =
spage_update (thread_p, page_p, slot_id, recdes_p);
22190 #if defined(CUBRID_DEBUG) 22192 "heap_update_physical: ** SYSTEM_ERROR ** update operation failed even when have already checked" 22200 if (old_record_type != recdes_p->
type)
22230 address.
pgptr = page_p;
22231 address.
vfid = vfid_p;
22264 heap_clear_operation_context (context, hfid_p);
22265 if (class_oid_p !=
NULL)
22291 heap_clear_operation_context (context, hfid_p);
22318 heap_clear_operation_context (context, hfid_p);
22360 PERF_UTIME_TRACKER time_track;
22361 bool is_mvcc_class;
22383 #if defined (SERVER_MODE) 22390 is_mvcc_op =
false;
22393 is_mvcc_op =
false;
22402 if (heap_insert_adjust_recdes_header (thread_p, context, is_mvcc_class) !=
NO_ERROR)
22408 #if defined(ENABLE_SYSTEMTAP) 22409 CUBRID_OBJ_INSERT_START (&context->
class_oid);
22415 if (heap_insert_handle_multipage_record (thread_p, context) !=
NO_ERROR)
22431 if (heap_get_insert_location_with_lock (thread_p, context,
NULL) !=
NO_ERROR)
22441 if (heap_insert_physical (thread_p, context) !=
NO_ERROR)
22477 heap_unfix_watchers (thread_p, context);
22506 #if defined(ENABLE_SYSTEMTAP) 22507 CUBRID_OBJ_INSERT_END (&context->
class_oid, (rc < 0));
22529 PERF_UTIME_TRACKER time_track;
22543 if (heap_is_valid_oid (thread_p, &context->
oid) !=
NO_ERROR)
22556 context->
file_type = heap_get_file_type (thread_p, context);
22585 #if defined (SERVER_MODE) 22588 is_mvcc_op =
false;
22595 is_mvcc_op =
false;
22598 #if defined(ENABLE_SYSTEMTAP) 22599 CUBRID_OBJ_DELETE_START (&context->
class_oid);
22605 if (heap_get_record_location (thread_p, context) !=
NO_ERROR)
22638 rc = heap_delete_bigone (thread_p, context, is_mvcc_op);
22642 rc = heap_delete_relocation (thread_p, context, is_mvcc_op);
22647 rc = heap_delete_home (thread_p, context, is_mvcc_op);
22675 heap_unfix_watchers (thread_p, context);
22677 #if defined(ENABLE_SYSTEMTAP) 22695 PERF_UTIME_TRACKER time_track;
22696 bool is_mvcc_class;
22718 context->
file_type = heap_get_file_type (thread_p, context);
22750 rc = heap_is_valid_oid (thread_p, &context->
oid);
22765 #if defined (SERVER_MODE) 22771 #if defined(ENABLE_SYSTEMTAP) 22772 CUBRID_OBJ_UPDATE_START (&context->
class_oid);
22778 rc = heap_get_record_location (thread_p, context);
22814 rc = heap_update_adjust_recdes_header (thread_p, context, is_mvcc_class);
22830 rc = heap_update_relocation (thread_p, context, is_mvcc_op);
22834 rc = heap_update_bigone (thread_p, context, is_mvcc_op);
22842 rc = heap_update_home (thread_p, context, is_mvcc_op);
22864 rc = heap_mark_class_as_modified (thread_p, &context->
oid,
or_chn (context->
recdes_p),
false);
22888 heap_unfix_watchers (thread_p, context);
22890 #if defined(ENABLE_SYSTEMTAP) 22941 heap_hfid_table_entry_alloc (
void)
22944 return (
void *) new_entry;
22953 heap_hfid_table_entry_free (
void *entry)
22972 heap_hfid_table_entry_init (
void *entry)
22976 if (entry_p ==
NULL)
22998 heap_hfid_table_entry_key_copy (
void *src,
void *
dest)
23021 static unsigned int 23022 heap_hfid_table_entry_key_hash (
void *key,
int hash_table_size)
23035 heap_hfid_table_entry_key_compare (
void *
k1,
void *k2)
23049 if (
OID_EQ (key1, key2))
23073 if (heap_Hfid_table !=
NULL)
23086 edesc->
f_alloc = heap_hfid_table_entry_alloc;
23087 edesc->
f_free = heap_hfid_table_entry_free;
23088 edesc->
f_init = heap_hfid_table_entry_init;
23090 edesc->
f_key_copy = heap_hfid_table_entry_key_copy;
23091 edesc->
f_key_cmp = heap_hfid_table_entry_key_compare;
23092 edesc->
f_hash = heap_hfid_table_entry_key_hash;
23112 heap_Hfid_table = &heap_Hfid_table_area;
23125 if (heap_Hfid_table !=
NULL)
23131 heap_Hfid_table =
NULL;
23172 int max_num_slots,
i;
23180 memset (&worker, 0,
sizeof (worker));
23195 for (
i = 0;
i < max_num_slots;
i++)
23200 reusable = heap_is_reusable_oid (upd_scancache->
file_type);
23238 &upd_scancache->
node.
hfid, &reusable,
false);
23300 entry->ftype = ftype;
23355 error_code = heap_get_hfid_from_class_record (thread_p, class_oid, &hfid_local);
23362 entry->
hfid = hfid_local;
23376 entry->
ftype = ftype_local;
23380 if (hfid_out !=
NULL)
23382 *hfid_out = entry->
hfid;
23384 if (ftype_out !=
NULL)
23386 *ftype_out = entry->
ftype;
23435 switch (vacuum_status)
23442 "Changed vacuum status for page %d|%d, lsa=%lld|%d from no vacuum to vacuum once.",
23450 "Changed vacuum status for page %d|%d, lsa=%lld|%d from vacuum once to unknown.",
23461 "Changed vacuum status for page %d|%d, lsa=%lld|%d from unknown to vacuum once.",
23481 (
unsigned long long int) mvccid);
23519 if (vacuum_status_change)
23523 switch (vacuum_status)
23530 "Change heap page %d|%d, lsa=%lld|%d, status from %s to once.",
23538 "Change heap page %d|%d, lsa=%lld|%d, status from once to unknown.",
23686 bool vacuum_status_change =
false;
23692 heap_page_rv_chain_update (thread_p, rcv->
pgptr, rcv->
mvcc_id, vacuum_status_change);
23790 #define HEAP_LOG_MVCC_REDISTRIBUTE_MAX_REDO_CRUMBS 4 23792 int n_redo_crumbs = 0, data_copy_offset = 0;
23813 redo_crumbs[n_redo_crumbs].
length =
sizeof (p_recdes->
type);
23814 redo_crumbs[n_redo_crumbs++].
data = &p_recdes->
type;
23823 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data;
23826 redo_crumbs[n_redo_crumbs++].
data = &delid;
23833 redo_crumbs[n_redo_crumbs].
length = p_recdes->
length - data_copy_offset;
23834 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data + data_copy_offset;
23859 bool vacuum_status_change =
false;
23866 vacuum_status_change =
true;
23871 record_type = *(INT16 *) rcv->
data;
23876 rcv->
data + sizeof (record_type));
23881 int repid_and_flags,
offset, mvcc_flag, offset_size;
23883 offset =
sizeof (record_type);
23928 heap_page_rv_chain_update (thread_p, rcv->
pgptr, rcv->
mvcc_id, vacuum_status_change);
23971 if (
LSA_LT (&oldest_prior_lsa, previous_version_lsa))
23978 assert (!
LSA_LT (&oldest_prior_lsa, previous_version_lsa));
24525 context->
oid_p = oid;
24621 recdes_p->
data = scan_cache_p->
area;
24645 #if !defined(NDEBUG) 24655 #if !defined(NDEBUG) 24707 error_code = heap_get_header_page (thread_p,
hfid, &vpid_header);
SCAN_CODE heap_get_record_data_when_all_ready(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context)
void stx_free_xasl_unpack_info(void *xasl_unpack_info)
HEAP_CLASSREPR_LOCK * lock_next
#define HEAP_PAGE_SET_VACUUM_STATUS(chain, status)
DISK_ISVALID not_vacuumed_res
OR_ATTRIBUTE * last_attrepr
MIN_MAX_COLUMN_INFO min_max_val
#define OR_SET_VAR_OFFSET_SIZE(val, offset_size)
DB_C_FLOAT db_get_float(const DB_VALUE *value)
int heap_vpid_prev(THREAD_ENTRY *thread_p, const HFID *hfid, PAGE_PTR pgptr, VPID *prev_vpid)
PAGE_PTR pgbuf_fix_debug(THREAD_ENTRY *thread_p, const VPID *vpid, PAGE_FETCH_MODE fetch_mode, PGBUF_LATCH_MODE request_mode, PGBUF_LATCH_CONDITION condition, const char *caller_file, int caller_line)
#define HEAP_PERF_TRACK_PREPARE(thread_p, context)
#define ER_PAGE_LATCH_ABORTED
#define CLASSREPR_HASH_SIZE
DB_VALUE * heap_attrinfo_access(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
#define PGBUF_PAGE_VPID_AS_ARGS(pg)
SCAN_CODE heap_capacity_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
SCAN_CODE heap_scanrange_next(THREAD_ENTRY *thread_p, OID *next_oid, RECDES *recdes, HEAP_SCANRANGE *scan_range, int ispeeking)
void heap_scancache_end_modify(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
OR_ATTRIBUTE * shared_attrs
bool tp_domain_references_objects(const TP_DOMAIN *dom)
int tp_domain_disk_size(TP_DOMAIN *domain)
#define PGBUF_WATCHER_COPY_GROUP(w_dst, w_src)
DB_VALUE * heap_attrvalue_get_key(THREAD_ENTRY *thread_p, int btid_index, HEAP_CACHE_ATTRINFO *idx_attrinfo, RECDES *recdes, BTID *btid, DB_VALUE *db_value, char *buf, FUNC_PRED_UNPACK_INFO *func_indx_pred, TP_DOMAIN **key_domain)
#define OR_MVCC_FLAG_VALID_DELID
int heap_object_upgrade_domain(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *upd_scancache, HEAP_CACHE_ATTRINFO *attr_info, OID *oid, const ATTR_ID att_id)
#define vacuum_er_log_error(er_log_level, msg,...)
int heap_rv_mark_deleted_on_postpone(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int qexec_clear_func_pred(THREAD_ENTRY *thread_p, FUNC_PRED *func_pred)
#define pgbuf_attach_watcher(...)
int xheap_get_class_num_objects_pages(THREAD_ENTRY *thread_p, const HFID *hfid, int approximation, int *nobjs, int *npages)
cubthread::entry * thread_get_thread_entry_info(void)
int db_value_coerce(const DB_VALUE *src, DB_VALUE *dest, const DB_DOMAIN *desired_domain)
int heap_header_capacity_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
int(* setval)(DB_VALUE *dest, const DB_VALUE *src, bool copy)
int mht_map_no_key(THREAD_ENTRY *thread_p, const MHT_TABLE *ht, int(*map_func)(THREAD_ENTRY *thread_p, void *data, void *args), void *func_args)
void log_append_redo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
#define LOG_IS_MVCC_HEAP_OPERATION(rcvindex)
int or_rep_id(RECDES *record)
int heap_get_hfid_from_class_oid(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid)
#define MVCC_IS_HEADER_DELID_VALID(rec_header_p)
DB_COLLECTION * db_get_set(const DB_VALUE *value)
int heap_get_class_oid_from_page(THREAD_ENTRY *thread_p, PAGE_PTR page_p, OID *class_oid)
#define MVCC_GET_INSID(header)
HEAP_CLASSREPR_HASH * hash_table
#define LANG_SYS_COLLATION
int pr_data_writeval_disk_size(DB_VALUE *value)
MVCC_SNAPSHOT * logtb_get_mvcc_snapshot(THREAD_ENTRY *thread_p)
#define MVCC_IS_CHN_UPTODATE(rec_header_p, chn)
#define pgbuf_ordered_fix(thread_p, req_vpid, fetch_mode, requestmode, req_watcher)
#define VACUUM_ER_LOG_RECOVERY
#define LF_EM_NOT_USING_MUTEX
void log_append_undoredo_data2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, int undo_length, int redo_length, const void *undo_data, const void *redo_data)
TP_DOMAIN_STATUS tp_domain_check(const TP_DOMAIN *domain, const DB_VALUE *value, TP_MATCH exact_match)
int xheap_has_instance(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, int has_visible_instance)
SCAN_CODE heap_last(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking)
OR_CLASSREP * read_classrepr
int db_value_domain_min(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale, const int codeset, const int collation_id, const DB_ENUMERATION *enumeration)
int vacuum_heap_page(THREAD_ENTRY *thread_p, VACUUM_HEAP_OBJECT *heap_objects, int n_heap_objects, MVCCID threshold_mvccid, HFID *hfid, bool *reusable, bool was_interrupted)
HEAP_SCANCACHE * scan_cache_p
#define HEAP_RV_FLAG_VACUUM_STATUS_CHANGE
void log_append_undoredo_crumbs(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int num_undo_crumbs, int num_redo_crumbs, const LOG_CRUMB *undo_crumbs, const LOG_CRUMB *redo_crumbs)
OR_FUNCTION_INDEX * func_index_info
#define OID_GT(oidp1, oidp2)
SCAN_CODE heap_scanrange_to_prior(THREAD_ENTRY *thread_p, HEAP_SCANRANGE *scan_range, OID *last_oid)
VACUUM_HEAP_OBJECT * heap_objects
STATIC_INLINE HEAP_CHAIN * heap_get_chain_ptr(THREAD_ENTRY *thread_p, PAGE_PTR page_heap) __attribute__((ALWAYS_INLINE))
#define HEAP_MAYNEED_DECACHE_GUESSED_LASTREPRS(class_oid, hfid)
int file_descriptor_update(THREAD_ENTRY *thread_p, const VFID *vfid, void *des_new)
unsigned int of_local_next
HEAP_BESTSPACE best[HEAP_NUM_BEST_SPACESTATS]
void lf_hash_destroy(LF_HASH_TABLE *table)
void logpb_fatal_error(THREAD_ENTRY *thread_p, bool logexit, const char *file_name, const int lineno, const char *fmt,...)
int heap_rv_redo_reuse_page(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int file_dealloc(THREAD_ENTRY *thread_p, const VFID *vfid, const VPID *vpid, FILE_TYPE file_type_hint)
#define QSTR_IS_ANY_CHAR(s)
bool is_redistribute_insert_with_delid
int heap_scancache_start_modify(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid, int op_type, MVCC_SNAPSHOT *mvcc_snapshot)
int heap_scancache_quick_start_modify_with_class_oid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, OID *class_oid)
LF_ENTRY_INITIALIZE_FUNC f_init
SCAN_CODE heap_get_visible_version(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, int old_chn)
int heap_attrinfo_delete_lob(THREAD_ENTRY *thread_p, RECDES *recdes, HEAP_CACHE_ATTRINFO *attr_info)
#define TP_IS_SET_TYPE(typenum)
#define ER_TF_BUFFER_OVERFLOW
void set_free(DB_COLLECTION *set)
int spage_insert(THREAD_ENTRY *thread_p, PAGE_PTR page_p, RECDES *record_descriptor_p, PGSLOTID *out_slot_id_p)
#define VPID_COPY(dest_ptr, src_ptr)
PAGEID pgbuf_get_page_id(PAGE_PTR pgptr)
int db_make_bigint(DB_VALUE *value, const DB_BIGINT num)
int db_get_int(const DB_VALUE *value)
int heap_prepare_object_page(THREAD_ENTRY *thread_p, const OID *oid, PGBUF_WATCHER *page_watcher_p, PGBUF_LATCH_MODE latch_mode)
int heap_manager_finalize(void)
void heap_finalize_hfid_table(void)
SCAN_CODE heap_prepare_get_context(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context, bool is_heap_scan, NON_EXISTENT_HANDLING non_ex_handling_type)
#define ER_HEAP_NODATA_NEWADDRESS
int logtb_get_number_of_total_tran_indices(void)
LOG_LSA * log_get_append_lsa(void)
LOG_LSA * logtb_find_current_tran_lsa(THREAD_ENTRY *thread_p)
DB_C_DOUBLE db_get_double(const DB_VALUE *value)
#define OR_MVCC_DELETE_ID_SIZE
PGBUF_WATCHER overflow_page_watcher
void spage_initialize(THREAD_ENTRY *thread_p, PAGE_PTR page_p, INT16 slot_type, unsigned short alignment, bool is_saving)
OR_ATTRIBUTE * class_attrs
bool mvcc_is_mvcc_disabled_class(const OID *class_oid)
pthread_mutex_t hash_mutex
int file_get_type(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_TYPE *ftype_out)
#define csect_enter(a, b, c)
TRAN_ABORT_REASON tran_abort_reason
#define DEFAULT_REPR_INCREMENT
DB_COLLECTION * set_copy(DB_COLLECTION *set)
#define OR_MVCC_MAX_HEADER_SIZE
int file_tracker_reuse_heap(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid_out)
DISK_ISVALID file_check_vpid(THREAD_ENTRY *thread_p, const VFID *vfid, const VPID *vpid_lookup)
SCAN_CODE spage_previous_record_dont_skip_empty(PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
int mht_rem(MHT_TABLE *ht, const void *key, int(*rem_func)(const void *key, void *data, void *args), void *func_args)
LF_ENTRY_UNINITIALIZE_FUNC f_uninit
#define HEAP_BIT_SET(byte_ptr, bit_num)
REPR_ID heap_get_class_repr_id(THREAD_ENTRY *thread_p, OID *class_oid)
struct heap_hdr_stats::@210 estimates
int lock_has_lock_on_object(const OID *oid, const OID *class_oid, int tran_index, LOCK lock)
int db_make_varchar(DB_VALUE *value, const int max_char_length, const DB_C_CHAR str, const int char_str_byte_size, const int codeset, const int collation_id)
BTREE_UNIQUE_STATS * index_stat_info
TP_DOMAIN_STATUS tp_value_auto_cast(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain)
int heap_rv_undo_update(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define HEAP_MAX_FIRSTSLOTID_LENGTH
#define SAFEGUARD_RVSPACE
#define ER_CT_UNKNOWN_REPRID
HEAP_STATS_ENTRY * free_list
void heap_rv_dump_chain(FILE *fp, int ignore_length, void *data)
const void * mht_put(MHT_TABLE *ht, const void *key, void *data)
PGBUF_WATCHER home_page_watcher
#define ASSERT_ERROR_AND_SET(error_code)
int(* index_writeval)(OR_BUF *buf, DB_VALUE *value)
SPAGE_SLOT * spage_get_slot(PAGE_PTR page_p, PGSLOTID slot_id)
LF_ENTRY_FREE_FUNC f_free
#define assert_release(e)
HEAP_CLASSREPR_ENTRY * area
void pgbuf_set_dirty(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, bool free_page)
char * overflow_get_first_page_data(char *page_ptr)
SCAN_CODE overflow_get(THREAD_ENTRY *thread_p, const VPID *ovf_vpid, RECDES *recdes, MVCC_SNAPSHOT *mvcc_snapshot)
void spage_update_record_type(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, INT16 record_type)
#define OR_OFFSET_SIZE_2BYTE
int pr_midxkey_init_boundbits(char *bufptr, int n_atts)
PGBUF_WATCHER * overflow_page_watcher_p
void heap_page_set_vacuum_status_none(THREAD_ENTRY *thread_p, PAGE_PTR heap_page)
int lock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, int cond_flag)
#define ER_CSS_PTHREAD_MUTEX_LOCK
void log_sysop_start(THREAD_ENTRY *thread_p)
#define OR_GET_BOUND_BIT_FLAG(ptr)
INT16 heap_rv_remove_flags_from_offset(INT16 offset)
int or_mvcc_get_header(RECDES *record, MVCC_REC_HEADER *mvcc_rec_header)
int heap_scancache_quick_start_root_hfid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
int heap_dump_capacity(THREAD_ENTRY *thread_p, FILE *fp, const HFID *hfid)
#define OR_MVCC_PREV_VERSION_LSA_OFFSET(mvcc_flags)
#define LOG_SET_DATA_ADDR(data_addr, page, vol_file_id, off)
DISK_ISVALID heap_check_all_pages(THREAD_ENTRY *thread_p, HFID *hfid)
struct timeval TSCTIMEVAL
#define OID_SET_NULL(oidp)
int or_mvcc_add_header(RECDES *record, MVCC_REC_HEADER *mvcc_rec_header, int bound_bit, int variable_offset_size)
XML_StartCdataSectionHandler start
#define OID_LT(oidp1, oidp2)
#define OR_GET_BOUND_BITS(obj, nvars, fsize)
#define OR_VAR_ELEMENT_PTR(obj, index)
HEAP_CLASSREPR_ENTRY * free_top
void thread_suspend_wakeup_and_unlock_entry(cubthread::entry *thread_p, thread_resume_suspend_status suspended_reason)
void heap_rv_dump_statistics(FILE *fp, int ignore_length, void *data)
int heap_get_best_space_num_stats_entries(void)
void tsc_elapsed_time_usec(TSCTIMEVAL *tv, TSC_TICKS end_tick, TSC_TICKS start_tick)
int db_elo_copy(DB_ELO *src, DB_ELO *dest)
struct spage_slot SPAGE_SLOT
TP_DOMAIN * tp_domain_copy(const TP_DOMAIN *domain, bool check_cache)
int lock_scan(THREAD_ENTRY *thread_p, const OID *class_oid, int cond_flag, LOCK class_lock)
void or_free_classrep(OR_CLASSREP *rep)
#define lf_tran_end_with_mb(entry)
HEAP_ATTRVALUE_STATE state
TP_DOMAIN * tp_domain_find_charbit(DB_TYPE type, int codeset, int collation_id, unsigned char collation_flag, int precision, bool is_desc)
#define LOG_CS_ENTER(thread_p)
void pgbuf_ordered_set_dirty_and_free(THREAD_ENTRY *thread_p, PGBUF_WATCHER *pg_watcher)
#define MVCC_CLEAR_FLAG_BITS(rec_header_p, flag)
#define BTID_IS_EQUAL(b1, b2)
PAGE_PTR pgbuf_flush_with_wal(THREAD_ENTRY *thread_p, PAGE_PTR pgptr)
int xheap_destroy_newly_created(THREAD_ENTRY *thread_p, const HFID *hfid, const OID *class_oid)
int heap_rv_mark_deleted_on_undo(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
SCAN_CODE heap_get_last_version(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context)
int * attrs_prefix_length
int file_get_sticky_first_page(THREAD_ENTRY *thread_p, const VFID *vfid, VPID *vpid_out)
#define MVCC_SET_DELID(header, mvcc_id)
LF_FREELIST hfid_hash_freelist
#define OR_BOUND_BIT_BYTES(count)
#define PGBUF_IS_CLEAN_WATCHER(w)
bool spage_reclaim(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
int heap_scancache_end_when_scan_will_resume(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
int heap_get_hfid_and_file_type_from_class_oid(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid_out, FILE_TYPE *ftype_out)
#define PTR_ALIGN(addr, boundary)
int db_make_string_copy(DB_VALUE *value, const char *str)
#define HEAP_SCANCACHE_SET_NODE(scan_cache, class_oid_p, hfid_p)
struct func_pred_unpack_info FUNC_PRED_UNPACK_INFO
MVCCID heap_page_get_max_mvccid(THREAD_ENTRY *thread_p, PAGE_PTR heap_page)
void or_class_hfid(RECDES *record, HFID *hfid)
enum tp_domain_status TP_DOMAIN_STATUS
#define er_log_debug(...)
void spage_set_need_update_best_hint(THREAD_ENTRY *thread_p, PAGE_PTR page_p, bool need_update)
PGSLOTID spage_delete_for_recovery(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
#define HEAP_CLASSREPR_MAXCACHE
int pgbuf_ordered_fix_debug(THREAD_ENTRY *thread_p, const VPID *req_vpid, PAGE_FETCH_MODE fetch_mode, const PGBUF_LATCH_MODE request_mode, PGBUF_WATCHER *req_watcher, const char *caller_file, int caller_line)
int or_mvcc_set_log_lsa_to_record(RECDES *record, LOG_LSA *lsa)
bool heap_does_exist(THREAD_ENTRY *thread_p, OID *class_oid, const OID *oid)
void * mht_get2(const MHT_TABLE *ht, const void *key, void **last)
int heap_scancache_end(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
HEAP_CLASSREPR_LOCK * lock_next
#define ER_HEAP_FOUND_NOT_VACUUMED
#define OR_VAR_OFFSET(obj, index)
HEAP_CHNGUESS_ENTRY * entries
int file_dump(THREAD_ENTRY *thread_p, const VFID *vfid, FILE *fp)
int db_make_elo(DB_VALUE *value, DB_TYPE type, const DB_ELO *elo)
bool spage_is_slot_exist(PAGE_PTR page_p, PGSLOTID slot_id)
#define ER_ALTER_CHANGE_CAST_FAILED_SET_DEFAULT
unsigned int oid_hash(const void *key_oid, unsigned int htsize)
int heap_attrinfo_start_with_index(THREAD_ENTRY *thread_p, OID *class_oid, RECDES *class_recdes, HEAP_CACHE_ATTRINFO *attr_info, HEAP_IDX_ELEMENTS_INFO *idx_info)
#define COPY_OID(dest_oid_ptr, src_oid_ptr)
#define heap_scan_pb_lock_and_fetch(...)
#define pthread_mutex_trylock(a)
SCAN_CODE spage_get_record(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p, int is_peeking)
HEAP_SCANCACHE_NODE_LIST * partition_list
int heap_objects_capacity
char * or_pack_mvccid(char *ptr, const MVCCID mvccid)
int mvcc_header_size_lookup[8]
bool spage_is_updatable(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int record_descriptor_length)
DB_ELO * db_get_elo(const DB_VALUE *value)
PGBUF_WATCHER fwd_page_watcher
int xlogtb_reset_wait_msecs(THREAD_ENTRY *thread_p, int wait_msecs)
#define vacuum_er_log_warning(er_log_level, msg,...)
#define OR_MVCC_FLAG_VALID_PREV_VERSION
int db_elo_delete(DB_ELO *elo)
SCAN_CODE heap_get_mvcc_header(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context, MVCC_REC_HEADER *mvcc_header)
#define ER_HEAP_MISMATCH_NPAGES
int file_create_with_npages(THREAD_ENTRY *thread_p, FILE_TYPE file_type, int npages, FILE_DESCRIPTORS *des, VFID *vfid)
#define LF_HASH_TABLE_INITIALIZER
VPID second_best[HEAP_NUM_BEST_SPACESTATS]
#define VFID_ISNULL(vfid_ptr)
SCAN_CODE heap_next_record_info(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *next_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, DB_VALUE **cache_recordinfo)
int overflow_update(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, const VPID *ovf_vpid, RECDES *recdes, FILE_TYPE file_type)
#define MVCCID_ALL_VISIBLE
#define pgbuf_unfix_and_init(thread_p, pgptr)
#define OR_VAR_IS_NULL(obj, index)
#define MVCC_GET_PREV_VERSION_LSA(header)
#define MVCC_SET_INSID(header, mvcc_id)
#define OR_MVCC_INSERT_HEADER_SIZE
#define ER_HEAP_UNABLE_TO_CREATE_HEAP
int spage_get_record_length(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
char * vpid_to_string(char *buf, int buf_size, VPID *vpid)
int heap_chnguess_put(THREAD_ENTRY *thread_p, const OID *oid, int tran_index, int chn)
void vacuum_log_add_dropped_file(THREAD_ENTRY *thread_p, const VFID *vfid, const OID *class_oid, bool pospone_or_undo)
#define HEAP_NUM_BEST_SPACESTATS
SCAN_CODE heap_attrinfo_transform_to_disk_except_lob(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, RECDES *old_recdes, RECDES *new_recdes)
#define LOG_FIND_CURRENT_TDES(thrd)
int pr_free_ext_value(DB_VALUE *value)
int spage_update(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, const RECDES *record_descriptor_p)
int heap_attrinfo_set_uninitialized_global(THREAD_ENTRY *thread_p, OID *inst_oid, RECDES *recdes, HEAP_CACHE_ATTRINFO *attr_info)
unsigned int of_del_tran_id
PGBUF_WATCHER home_page_watcher
BTREE_SEARCH xbtree_find_unique(THREAD_ENTRY *thread_p, BTID *btid, SCAN_OPERATION_TYPE scan_op_type, DB_VALUE *key, OID *class_oid, OID *oid, bool is_all_class_srch)
#define OID_PSEUDO_KEY(oidp)
int heap_scancache_start(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid, int cache_last_fix_page, int is_indexscan, MVCC_SNAPSHOT *mvcc_snapshot)
#define HEAP_NBYTES_CLEARED(byte_ptr, byte_cnt)
DB_MONETARY * db_get_monetary(const DB_VALUE *value)
HEAP_CLASSREPR_ENTRY * hash_next
void mht_destroy(MHT_TABLE *ht)
bool pr_is_set_type(DB_TYPE type)
int file_tracker_interruptable_iterate(THREAD_ENTRY *thread_p, FILE_TYPE desired_ftype, VFID *vfid, OID *class_oid)
int file_descriptor_get(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_DESCRIPTORS *desc_out)
#define HEAP_CHK_ADD_UNFOUND_RELOCOIDS
int boot_find_root_heap(HFID *root_hfid_p)
PAGE_TYPE pgbuf_get_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr)
#define HEAP_GUESS_NUM_INDEXED_ATTRS
int file_alloc_sticky_first_page(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_INIT_PAGE_FUNC f_init, void *f_init_args, VPID *vpid_out, PAGE_PTR *page_out)
int heap_attrinfo_start(THREAD_ENTRY *thread_p, const OID *class_oid, int requested_num_attrs, const ATTR_ID *attrids, HEAP_CACHE_ATTRINFO *attr_info)
int spage_max_record_size(void)
int heap_scancache_quick_start_modify(HEAP_SCANCACHE *scan_cache)
int spage_check(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
void spage_dump(THREAD_ENTRY *thread_p, FILE *fp, PAGE_PTR page_p, int is_record_printed)
#define RECDES_INITIALIZER
int lf_hash_init(LF_HASH_TABLE *table, LF_FREELIST *freelist, unsigned int hash_size, LF_ENTRY_DESCRIPTOR *edesc)
#define MVCCID_IS_NORMAL(id)
#define HEAP_BESTSPACE_SYNC_THRESHOLD
TP_DOMAIN * tp_domain_resolve_default(DB_TYPE type)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
int spage_max_space_for_new_record(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
#define HEAP_STATS_ENTRY_FREELIST_SIZE
void logpb_flush_pages_direct(THREAD_ENTRY *thread_p)
int db_set_get(DB_SET *set, int index, DB_VALUE *value)
PGBUF_WATCHER * forward_page_watcher_p
char * fileio_get_volume_label(VOLID vol_id, bool is_peek)
#define ER_QPROC_INVALID_PARAMETER
#define HEAP_HEADER_AND_CHAIN_SLOTID
int heap_attrinfo_read_dbvalues_without_oid(THREAD_ENTRY *thread_p, RECDES *recdes, HEAP_CACHE_ATTRINFO *attr_info)
bool pgbuf_has_prevent_dealloc(PAGE_PTR pgptr)
void log_skip_logging(THREAD_ENTRY *thread_p, LOG_DATA_ADDR *addr)
struct or_partition OR_PARTITION
int heap_rv_redo_insert(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
HEAP_PAGE_VACUUM_STATUS heap_page_get_vacuum_status(THREAD_ENTRY *thread_p, PAGE_PTR heap_page)
SCAN_CODE heap_page_prev(THREAD_ENTRY *thread_p, const OID *class_oid, const HFID *hfid, VPID *prev_vpid, DB_VALUE **cache_pageinfo)
REGU_VARIABLE * func_regu
int heap_rv_mvcc_redo_delete_home(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define ER_LK_PAGE_TIMEOUT
LF_ENTRY_KEY_COPY_FUNC f_key_copy
int heap_get_mvcc_rec_header_from_overflow(PAGE_PTR ovf_page, MVCC_REC_HEADER *mvcc_header, RECDES *peek_recdes)
#define pthread_mutex_destroy(a)
#define ER_LC_UNKNOWN_CLASSNAME
int spage_check_slot_owner(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
#define HEAP_STATS_ENTRY_MHT_EST_SIZE
bool pgbuf_check_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
#define OR_ENABLE_BOUND_BIT(bitptr, element)
#define ER_SP_NOSPACE_IN_PAGE
#define OR_MVCC_INSERT_ID_OFFSET
int file_get_num_user_pages(THREAD_ENTRY *thread_p, const VFID *vfid, int *n_user_pages_out)
void heap_clean_get_context(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context)
#define PGBUF_WATCHER_RESET_RANK(w, rank)
DISK_ISVALID vacuum_check_not_vacuumed_recdes(THREAD_ENTRY *thread_p, OID *oid, OID *class_oid, RECDES *recdes, int btree_node_type)
SCAN_CODE heap_scan_get_visible_version(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, int old_chn)
int prm_get_integer_value(PARAM_ID prm_id)
int heap_rv_mvcc_redo_redistribute(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
unsigned is_autoincrement
int heap_scanrange_start(THREAD_ENTRY *thread_p, HEAP_SCANRANGE *scan_range, const HFID *hfid, const OID *class_oid, MVCC_SNAPSHOT *mvcc_snapshot)
DISK_ISVALID heap_check_all_heaps(THREAD_ENTRY *thread_p)
OR_DEFAULT_VALUE default_value
#define OID_IS_ROOTOID(oidp)
unsigned int record_length
int tp_domain_status_er_set(TP_DOMAIN_STATUS status, const char *file_name, const int line_no, const DB_VALUE *src, const TP_DOMAIN *domain)
LF_ENTRY_KEY_COMPARE_FUNC f_key_cmp
void heap_classrepr_dump_all(THREAD_ENTRY *thread_p, FILE *fp, OID *class_oid)
BTID * heap_indexinfo_get_btid(int btid_index, HEAP_CACHE_ATTRINFO *attrinfo)
LC_FIND_CLASSNAME xlocator_find_class_oid(THREAD_ENTRY *thread_p, const char *classname, OID *class_oid, LOCK lock)
OR_ATTRIBUTE * heap_locate_last_attrepr(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
void heap_rv_dump_reuse_page(FILE *fp, int ignore_length, void *ignore_data)
#define ER_IT_DATA_OVERFLOW
#define ER_OUT_OF_VIRTUAL_MEMORY
void log_append_undo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
LPOLESTR DBORDINAL flags dbtype
int or_chn(RECDES *record)
DB_TYPE db_value_type(const DB_VALUE *value)
int orc_superclasses_from_record(RECDES *record, int *array_size, OID **array_ptr)
#define LF_ENTRY_DESCRIPTOR_INITIALIZER
int heap_get_class_name_alloc_if_diff(THREAD_ENTRY *thread_p, const OID *class_oid, char *guess_classname, char **classname_out)
#define OR_VALUE_ALIGNED_SIZE(value)
#define SINGLE_ROW_UPDATE
int heap_get_hfid_from_vfid(THREAD_ENTRY *thread_p, const VFID *vfid, HFID *hfid)
lf_tran_entry * thread_get_tran_entry(cubthread::entry *thread_p, int entry_idx)
#define ER_HF_MAX_BESTSPACE_ENTRIES
bool oid_is_root(const OID *oid)
#define OR_FIXED_ATTRIBUTES_OFFSET_BY_OBJ(obj, nvars)
#define pgbuf_replace_watcher(thread_p, old_watcher, new_watcher)
STATIC_INLINE void LSA_COPY(LOG_LSA *plsa1, const LOG_LSA *plsa2)
#define ER_HEAP_WRONG_ATTRINFO
int or_put_int(OR_BUF *buf, int num)
int heap_update_logical(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
pthread_mutex_t bestspace_mutex
int intl_identifier_casecmp(const char *str1, const char *str2)
int numeric_db_value_coerce_from_num(DB_VALUE *src, DB_VALUE *dest, DB_DATA_STATUS *data_status)
#define DB_VALUE_DOMAIN_TYPE(value)
void spage_collect_statistics(PAGE_PTR page_p, int *npages, int *nrecords, int *rec_length)
#define VACUUM_ER_LOG_HEAP
#define DB_MAX_IDENTIFIER_LENGTH
void heap_create_update_context(HEAP_OPERATION_CONTEXT *context, HFID *hfid_p, OID *oid_p, OID *class_oid_p, RECDES *recdes_p, HEAP_SCANCACHE *scancache_p, UPDATE_INPLACE_STYLE in_place)
int heap_manager_initialize(void)
THREAD_ENTRY * next_wait_thrd
LOG_PAGEID logical_pageid
void heap_create_insert_context(HEAP_OPERATION_CONTEXT *context, HFID *hfid_p, OID *class_oid_p, RECDES *recdes_p, HEAP_SCANCACHE *scancache_p)
bool heap_remove_page_on_vacuum(THREAD_ENTRY *thread_p, PAGE_PTR *page_ptr, HFID *hfid)
int spage_compact(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
#define TP_DOMAIN_COLLATION(dom)
int heap_rv_redo_update_and_update_chain(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define OR_HEADER_SIZE(ptr)
int or_put_bigint(OR_BUF *buf, DB_BIGINT num)
void lock_unlock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, bool force)
int heap_rv_redo_newpage(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define VPID_EQ(vpid_ptr1, vpid_ptr2)
HEAP_ATTRVALUE * heap_attrvalue_locate(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
DB_VALUE * heap_attrinfo_generate_key(THREAD_ENTRY *thread_p, int n_atts, int *att_ids, int *atts_prefix_length, HEAP_CACHE_ATTRINFO *attr_info, RECDES *recdes, DB_VALUE *db_valuep, char *buf, FUNCTION_INDEX_INFO *func_index_info)
int heap_get_num_objects(THREAD_ENTRY *thread_p, const HFID *hfid, int *npages, int *nobjs, int *avg_length)
int spage_mark_deleted_slot_as_reusable(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
int heap_insert_logical(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
#define HFID_SET_NULL(hfid)
#define OR_NON_MVCC_HEADER_SIZE
HEAP_CLASSREPR_ENTRY * LRU_bottom
#define ER_ALTER_CHANGE_CAST_FAILED_SET_MAX
#define ER_QPROC_SIZE_STRING_TRUNCATED
#define OID_EQ(oidp1, oidp2)
#define OR_MVCC_PREV_VERSION_LSA_SIZE
#define OR_MVCC_FLAG_MASK
DB_VALUE * db_value_copy(DB_VALUE *value)
#define heap_classrepr_free_and_init(class_repr, idxp)
SCAN_CODE spage_get_page_header_info(PAGE_PTR page_p, DB_VALUE **page_header_info)
int heap_attrinfo_read_dbvalues(THREAD_ENTRY *thread_p, const OID *inst_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, HEAP_CACHE_ATTRINFO *attr_info)
int locator_attribute_info_force(THREAD_ENTRY *thread_p, const HFID *hfid, OID *oid, HEAP_CACHE_ATTRINFO *attr_info, ATTR_ID *att_id, int n_att_id, LC_COPYAREA_OPERATION operation, int op_type, HEAP_SCANCACHE *scan_cache, int *force_count, bool not_check_fk, REPL_INFO_TYPE repl_info, int pruning_type, PRUNING_CONTEXT *pcontext, FUNC_PRED_UNPACK_INFO *func_preds, MVCC_REEV_DATA *mvcc_reev_data, UPDATE_INPLACE_STYLE force_update_inplace, RECDES *rec_descriptor, bool need_locking)
#define TP_DOMAIN_TYPE(dom)
int logpb_fetch_page(THREAD_ENTRY *thread_p, LOG_LSA *req_lsa, LOG_CS_ACCESS_MODE access_mode, LOG_PAGE *log_pgptr)
XML_EndCdataSectionHandler end
#define OR_MVCC_FLAG_SHIFT_BITS
int overflow_get_capacity(THREAD_ENTRY *thread_p, const VPID *ovf_vpid, int *ovf_size, int *ovf_num_pages, int *ovf_overhead, int *ovf_free_space)
MVCC_SATISFIES_SNAPSHOT_RESULT mvcc_is_not_deleted_for_snapshot(THREAD_ENTRY *thread_p, MVCC_REC_HEADER *rec_header, MVCC_SNAPSHOT *snapshot)
int heap_estimate(THREAD_ENTRY *thread_p, const HFID *hfid, int *npages, int *nobjs, int *avg_length)
#define ER_HEAP_UNKNOWN_HEAP
void * mht_get(MHT_TABLE *ht, const void *key)
#define HEAP_HFID_HASH_SIZE
int or_put_offset_internal(OR_BUF *buf, int num, int offset_size)
int file_alloc(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_INIT_PAGE_FUNC f_init, void *f_init_args, VPID *vpid_out, PAGE_PTR *page_out)
int db_string_truncate(DB_VALUE *value, const int precision)
int heap_attrinfo_clear_dbvalues(HEAP_CACHE_ATTRINFO *attr_info)
int lf_hash_find_or_insert(LF_TRAN_ENTRY *tran, LF_HASH_TABLE *table, void *key, void **entry, int *inserted)
PGNSLOTS spage_number_of_records(PAGE_PTR page_p)
void db_value_fprint(FILE *fp, const DB_VALUE *value)
#define MVCC_IS_FLAG_SET(rec_header_p, flags)
#define HEAP_LOG_MVCC_INSERT_MAX_REDO_CRUMBS
HEAP_CLASSREPR_LOCK * lock_table
int heap_indexinfo_get_attrs_prefix_length(int btid_index, HEAP_CACHE_ATTRINFO *attrinfo, int *attrs_prefix_length, int len_attrs_prefix_length)
const char * pr_type_name(DB_TYPE id)
#define HEAP_GUESS_NUM_ATTRS_REFOIDS
void tsc_getticks(TSC_TICKS *tck)
OR_CLASSREP ** or_get_all_representation(RECDES *record, bool do_indexes, int *count)
HEAP_SCANCACHE scan_cache
int heap_scancache_quick_start_with_class_oid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, OID *class_oid)
int or_class_get_partition_info(RECDES *record, OR_PARTITION *partition_info, REPR_ID *repr_id, int *has_partition_info)
#define vacuum_er_log(er_log_level, msg,...)
#define HEAP_DEBUG_ISVALID_SCANRANGE(scan_range)
#define HEAP_STATS_PREV_BEST_INDEX(i)
LF_TRAN_SYSTEM hfid_table_Ts
#define LC_NEXT_ONEOBJ_PTR_IN_COPYAREA(oneobj_ptr)
#define OR_MVCC_DELETE_ID_OFFSET(mvcc_flags)
int(* data_writeval)(OR_BUF *buf, DB_VALUE *value)
OR_ATTRIBUTE * read_attrepr
void log_append_undoredo_recdes(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, const RECDES *undo_recdes, const RECDES *redo_recdes)
#define BEST_PAGE_SEARCH_MAX_COUNT
int heap_vpid_next(THREAD_ENTRY *thread_p, const HFID *hfid, PAGE_PTR pgptr, VPID *next_vpid)
#define BTID_SET_NULL(btid)
int file_create_heap(THREAD_ENTRY *thread_p, bool reuse_oid, const OID *class_oid, VFID *vfid)
int db_value_domain_max(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale, const int codeset, const int collation_id, const DB_ENUMERATION *enumeration)
TP_DOMAIN * tp_domain_cache(TP_DOMAIN *transient)
LF_ENTRY_DUPLICATE_KEY_HANDLER f_duplicate
int db_seq_free(DB_SEQ *seq)
int heap_estimate_num_objects(THREAD_ENTRY *thread_p, const HFID *hfid)
#define db_private_free_and_init(thrd, ptr)
int xserial_get_next_value(THREAD_ENTRY *thread_p, DB_VALUE *result_num, const OID *oid_p, int cached_num, int num_alloc, int is_auto_increment, bool force_set_last_insert_id)
void log_append_undoredo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int undo_length, int redo_length, const void *undo_data, const void *redo_data)
int lf_freelist_init(LF_FREELIST *freelist, int initial_blocks, int block_size, LF_ENTRY_DESCRIPTOR *edesc, LF_TRAN_SYSTEM *tran_system)
#define pgbuf_fix(thread_p, vpid, fetch_mode, requestmode, condition)
void thread_lock_entry(cubthread::entry *thread_p)
#define HEAP_UPDATE_IS_MVCC_OP(is_mvcc_class, update_style)
int numeric_db_value_is_positive(const DB_VALUE *dbvalue)
MHT_TABLE * mht_create(const char *name, int est_size, unsigned int(*hash_func)(const void *key, unsigned int ht_size), int(*cmp_func)(const void *key1, const void *key2))
#define MVCC_ID_PRECEDES(id1, id2)
#define HEAP_PAGE_GET_VACUUM_STATUS(chain)
#define HEAP_LOG_MVCC_REDISTRIBUTE_MAX_REDO_CRUMBS
DISK_ISVALID disk_is_page_sector_reserved(THREAD_ENTRY *thread_p, VOLID volid, PAGEID pageid)
#define db_private_free(thrd, ptr)
void or_init(OR_BUF *buf, char *data, int length)
int heap_rv_update_chain_after_mvcc_op(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
STATIC_INLINE int heap_copy_chain(THREAD_ENTRY *thread_p, PAGE_PTR page_heap, HEAP_CHAIN *chain) __attribute__((ALWAYS_INLINE))
#define db_private_alloc(thrd, size)
SCAN_CODE spage_next_record_dont_skip_empty(PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
PGBUF_WATCHER page_watcher
PGSLOTID spage_find_free_slot(PAGE_PTR page_p, SPAGE_SLOT **out_slot_p, PGSLOTID start_slot)
const OID * heap_ovf_delete(THREAD_ENTRY *thread_p, const HFID *hfid, const OID *ovf_oid, VFID *ovf_vfid_p)
LPOLESTR DBORDINAL flags BYTE BYTE offsetof(_Class, member) \ }
#define BIG_VAR_OFFSET_SIZE
need_clear_type need_clear
bool logtb_set_check_interrupt(THREAD_ENTRY *thread_p, bool flag)
#define CEIL_PTVDIV(dividend, divisor)
#define LSA_ISNULL(lsa_ptr)
HEAP_CLASSREPR_ENTRY * hash_next
int heap_rv_redo_delete(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int db_set_size(DB_SET *set)
OR_CLASSREP * heap_classrepr_get(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *class_recdes, REPR_ID reprid, int *idx_incache)
void er_set_with_oserror(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
void heap_attrinfo_dump(THREAD_ENTRY *thread_p, FILE *fp, HEAP_CACHE_ATTRINFO *attr_info, bool dump_schema)
LC_COPYAREA_ONEOBJ ** obj
VFID * heap_ovf_find_vfid(THREAD_ENTRY *thread_p, const HFID *hfid, VFID *ovf_vfid, bool docreate, PGBUF_LATCH_CONDITION latch_cond)
#define IO_DEFAULT_PAGE_SIZE
int pr_clear_value(DB_VALUE *value)
void heap_scanrange_end(THREAD_ENTRY *thread_p, HEAP_SCANRANGE *scan_range)
SCAN_CODE heap_scanrange_to_following(THREAD_ENTRY *thread_p, HEAP_SCANRANGE *scan_range, OID *start_oid)
DB_BIGINT db_get_bigint(const DB_VALUE *value)
int heap_scan_cache_allocate_area(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache_p, int size)
struct btree_unique_stats BTREE_UNIQUE_STATS
char home_recdes_buffer[IO_MAX_PAGE_SIZE+MAX_ALIGNMENT]
void pgbuf_get_vpid(PAGE_PTR pgptr, VPID *vpid)
#define HEAP_NBYTES_TO_NBITS(byte_cnt)
int db_value_domain_default(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale, const int codeset, const int collation_id, DB_ENUMERATION *enumeration)
#define VFID_COPY(vfid_ptr1, vfid_ptr2)
pthread_mutex_t free_mutex
int heap_rv_redo_mark_reusable_slot(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define LF_FREELIST_INITIALIZER
void log_sysop_abort(THREAD_ENTRY *thread_p)
#define MVCC_SET_FLAG_BITS(rec_header_p, flag)
int heap_vacuum_all_objects(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *upd_scancache, MVCCID threshold_mvccid)
void heap_chnguess_clear(THREAD_ENTRY *thread_p, int tran_index)
SCAN_CODE heap_first(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking)
#define ER_ALTER_CHANGE_CAST_FAILED_SET_MIN
struct db_domain_info::general_info general_info
HEAP_CLASSREPR_ENTRY * next
void heap_create_delete_context(HEAP_OPERATION_CONTEXT *context, HFID *hfid_p, OID *oid_p, OID *class_oid_p, HEAP_SCANCACHE *scancache_p)
#define HEAP_NBITS_TO_NBYTES(bit_cnt)
#define OR_CLEAR_BOUND_BIT(bitptr, element)
OR_CLASSREP * or_get_classrep(RECDES *record, int repid)
MVCCID logtb_get_current_mvccid(THREAD_ENTRY *thread_p)
#define OR_VAR_LENGTH(length, obj, index, n_variables)
DB_ENUMERATION enumeration
#define TP_IS_CHAR_TYPE(typeid)
PGNSLOTS spage_number_of_slots(PAGE_PTR page_p)
TP_DOMAIN_COLL_ACTION collation_flag
int heap_get_index_with_name(THREAD_ENTRY *thread_p, OID *class_oid, const char *index_name, BTID *btid)
int heap_rv_redo_reuse_page_reuse_oid(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int file_descriptor_dump(THREAD_ENTRY *thread_p, const VFID *vfid, FILE *fp)
int heap_classrepr_decache(THREAD_ENTRY *thread_p, const OID *class_oid)
LF_ENTRY_HASH_FUNC f_hash
int file_init_page_type(THREAD_ENTRY *thread_p, PAGE_PTR page, void *args)
void log_append_postpone(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
#define VPID_ISNULL(vpid_ptr)
#define HEAP_MVCC_SET_HEADER_MAXIMUM_SIZE(mvcc_rec_header_p)
#define ER_SP_INVALID_HEADER
int heap_chnguess_get(THREAD_ENTRY *thread_p, const OID *oid, int tran_index)
int heap_classrepr_find_index_id(OR_CLASSREP *classrepr, const BTID *btid)
void log_append_undo_recdes2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, const RECDES *recdes)
int heap_prefetch(THREAD_ENTRY *thread_p, OID *class_oid, const OID *oid, LC_COPYAREA_DESC *prefetch)
int xheap_destroy(THREAD_ENTRY *thread_p, const HFID *hfid, const OID *class_oid)
STATIC_INLINE void perfmon_inc_stat(THREAD_ENTRY *thread_p, PERF_STAT_ID psid) __attribute__((ALWAYS_INLINE))
int heap_get_btid_from_index_name(THREAD_ENTRY *thread_p, const OID *p_class_oid, const char *index_name, BTID *p_found_btid)
void file_postpone_destroy(THREAD_ENTRY *thread_p, const VFID *vfid)
#define pthread_mutex_unlock(a)
TP_DOMAIN * tp_domain_construct(DB_TYPE domain_type, DB_OBJECT *class_obj, int precision, int scale, TP_DOMAIN *setdomain)
int heap_set_mvcc_rec_header_on_overflow(PAGE_PTR ovf_page, MVCC_REC_HEADER *mvcc_header)
PGBUF_WATCHER forward_page_watcher
PGSLOTID spage_delete(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
SCAN_CODE heap_get_class_oid(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid)
int db_make_midxkey(DB_VALUE *value, DB_MIDXKEY *midxkey)
#define LOG_FIND_THREAD_TRAN_INDEX(thrd)
int heap_classrepr_free(OR_CLASSREP *classrep, int *idx_incache)
void overflow_flush(THREAD_ENTRY *thread_p, const VPID *ovf_vpid)
#define MVCC_GET_FLAG(header)
#define HFID_IS_NULL(hfid)
#define ER_PB_UNEXPECTED_PAGE_REFIX
bool db_value_is_null(const DB_VALUE *value)
char * or_class_name(RECDES *record)
#define LOG_DATA_ADDR_INITIALIZER
#define OR_FIXED_ATT_IS_UNBOUND(obj, nvars, fsize, position)
STATIC_INLINE HEAP_HDR_STATS * heap_get_header_stats_ptr(THREAD_ENTRY *thread_p, PAGE_PTR page_header) __attribute__((ALWAYS_INLINE))
#define QSTR_IS_NATIONAL_CHAR(s)
VOLID pgbuf_get_volume_id(PAGE_PTR pgptr)
#define HEAP_PERF_START(thread_p, context)
LF_ENTRY_ALLOC_FUNC f_alloc
#define HEAP_DROP_FREE_SPACE
int pr_clone_value(const DB_VALUE *src, DB_VALUE *dest)
int heap_rv_mvcc_undo_delete(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int heap_rv_redo_update(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int heap_rv_mvcc_redo_delete_overflow(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
OID * db_get_oid(const DB_VALUE *value)
int log_add_to_modified_class_list(THREAD_ENTRY *thread_p, const char *classname, const OID *class_oid)
#define ER_HEAP_UNKNOWN_ATTRS
void heap_init_get_context(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context, const OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, int old_chn)
#define ER_ALTER_CHANGE_TRUNC_OVERFLOW_NOT_ALLOWED
SCAN_CODE heap_attrinfo_transform_to_disk(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, RECDES *old_recdes, RECDES *new_recdes)
int logpb_prior_lsa_append_all_list(THREAD_ENTRY *thread_p)
float prm_get_float_value(PARAM_ID prm_id)
const void * mht_put_new(MHT_TABLE *ht, const void *key, void *data)
int heap_delete_logical(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
#define OR_MVCC_FLAG_VALID_INSID
int or_mvcc_set_header(RECDES *record, MVCC_REC_HEADER *mvcc_rec_header)
#define VACUUM_LOG_ADD_DROPPED_FILE_POSTPONE
unsigned int offset_to_record
#define BTREE_IS_MULTI_ROW_OP(op)
OR_CLASSREP * last_classrepr
MVCC_SNAPSHOT * mvcc_snapshot
unsigned int mht_count(const MHT_TABLE *ht)
#define LOG_CS_EXIT(thread_p)
#define pthread_mutex_init(a, b)
PGBUF_WATCHER * home_page_watcher_p
#define MVCC_SET_REPID(header, rep_id)
STATIC_INLINE void LSA_SET_NULL(LOG_LSA *lsa_ptr)
int xheap_create(THREAD_ENTRY *thread_p, HFID *hfid, const OID *class_oid, bool reuse_oid)
int stx_map_stream_to_func_pred(THREAD_ENTRY *thread_p, FUNC_PRED **xasl, char *xasl_stream, int xasl_stream_size, void **xasl_unpack_info_ptr)
bool vacuum_is_mvccid_vacuumed(MVCCID id)
#define free_and_init(ptr)
int heap_scancache_quick_start_with_class_hfid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid)
#define OR_OFFSET_SIZE_FLAG
bool heap_attrinfo_check_unique_index(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, ATTR_ID *att_id, int n_att_id)
#define DB_ALIGN(offset, align)
#define BTID_COPY(btid_ptr1, btid_ptr2)
SCAN_CODE spage_previous_record(PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
#define HEAP_BIT_CLEAR(byte_ptr, bit_num)
int or_get_attrname(RECDES *record, int attrid, char **string, int *alloced_string)
int heap_initialize_hfid_table(void)
#define OR_GET_MVCC_FLAG(ptr)
int oid_compare_equals(const void *key_oid1, const void *key_oid2)
#define HEAP_CHKRELOC_UNFOUND_SHORT
void heap_dump(THREAD_ENTRY *thread_p, FILE *fp, HFID *hfid, bool dump_records)
#define MVCC_SET_CHN(header, chn_)
#define OR_VAR_TABLE_SIZE_INTERNAL(vars, offset_size)
int heap_get_class_partitions(THREAD_ENTRY *thread_p, const OID *class_oid, OR_PARTITION **parts, int *parts_count)
DISK_ISVALID heap_check_heap_file(THREAD_ENTRY *thread_p, HFID *hfid)
int heap_attrinfo_start_with_btid(THREAD_ENTRY *thread_p, OID *class_oid, BTID *btid, HEAP_CACHE_ATTRINFO *attr_info)
#define ER_FILE_NOT_ENOUGH_PAGES_IN_DATABASE
#define OR_GET_MVCC_CHN(ptr)
PGBUF_WATCHER * header_page_watcher_p
#define ER_HEAP_UNKNOWN_OBJECT
#define MVCC_GET_DELID(header)
void lf_freelist_destroy(LF_FREELIST *freelist)
PGBUF_WATCHER header_page_watcher
int mht_rem2(MHT_TABLE *ht, const void *key, const void *data, int(*rem_func)(const void *key, void *data, void *args), void *func_args)
void pgbuf_set_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
bool heap_is_page_header(THREAD_ENTRY *thread_p, PAGE_PTR page)
bool prm_get_bool_value(PARAM_ID prm_id)
#define QSTR_IS_ANY_CHAR_OR_BIT(s)
#define HFID_EQ(hfid_ptr1, hfid_ptr2)
int orc_subclasses_from_record(RECDES *record, int *array_size, OID **array_ptr)
int heap_rv_mvcc_undo_delete_overflow(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define HEAP_BIT_GET(byte_ptr, bit_num)
int spage_get_free_space_without_saving(THREAD_ENTRY *thread_p, PAGE_PTR page_p, bool *need_update)
#define OR_PUT_INT(ptr, val)
DISK_ISVALID vacuum_check_not_vacuumed_rec_header(THREAD_ENTRY *thread_p, OID *oid, OID *class_oid, MVCC_REC_HEADER *rec_header, int btree_node_type)
int db_get_string_size(const DB_VALUE *value)
SCAN_CODE heap_prev(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *next_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking)
DB_C_SHORT db_get_short(const DB_VALUE *value)
HEAP_CACHE_ATTRINFO * cache_attrinfo
int file_rv_tracker_mark_heap_deleted(THREAD_ENTRY *thread_p, LOG_RCV *rcv, bool is_undo)
#define HEAP_PERF_TRACK_LOGGING(thread_p, context)
int(* data_readval)(OR_BUF *buf, DB_VALUE *value, struct tp_domain *domain, int size, bool copy, char *copy_buf, int copy_buf_len)
unsigned page_was_unfixed
void log_sysop_attach_to_outer(THREAD_ENTRY *thread_p)
#define REPR_HASH(class_oid)
std::size_t thread_num_total_threads(void)
void log_sysop_commit(THREAD_ENTRY *thread_p)
int or_put_data(OR_BUF *buf, const char *data, int length)
SCAN_CODE spage_next_record(PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
#define OR_GET_MVCC_REPID_AND_FLAG(ptr)
STATIC_INLINE int heap_get_last_vpid(THREAD_ENTRY *thread_p, const HFID *hfid, VPID *last_vpid) __attribute__((ALWAYS_INLINE))
#define DB_VALUE_TYPE(value)
void heap_flush(THREAD_ENTRY *thread_p, const OID *oid)
#define PGBUF_ORDERED_NULL_HFID
STATIC_INLINE int heap_copy_header_stats(THREAD_ENTRY *thread_p, PAGE_PTR page_header, HEAP_HDR_STATS *header_stats) __attribute__((ALWAYS_INLINE))
int mht_map(const MHT_TABLE *ht, int(*map_func)(const void *key, void *data, void *args), void *func_args)
int db_make_null(DB_VALUE *value)
int spage_get_free_space(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
#define DB_IS_NULL(value)
int heap_assign_address(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *oid, int expected_length)
#define OR_GET_OFFSET_SIZE(ptr)
int spage_slot_size(void)
bool heap_should_try_update_stat(const int current_freespace, const int prev_freespace)
int vacuum_rv_check_at_undo(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, INT16 slotid, INT16 rec_type)
#define HEAP_SET_RECORD(recdes, record_area_size, record_length, record_type, record_data)
int heap_delete_hfid_from_cache(THREAD_ENTRY *thread_p, OID *class_oid)
HEAP_CLASSREPR_ENTRY * LRU_top
MVCC_SNAPSHOT_FUNC snapshot_fnc
int lf_hash_delete(LF_TRAN_ENTRY *tran, LF_HASH_TABLE *table, void *key, int *success)
bool heap_is_big_length(int length)
int heap_rv_undoredo_pagehdr(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
HEAP_SCANCACHE_NODE_LIST * next
int heap_indexinfo_get_attrids(int btid_index, HEAP_CACHE_ATTRINFO *attrinfo, ATTR_ID *attrids)
#define MVCC_REC_HEADER_INITIALIZER
SCAN_CODE heap_header_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
int db_make_int(DB_VALUE *value, const int num)
int db_get_string_length(const DB_VALUE *value)
void heap_attrinfo_end(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info)
bool pgbuf_has_any_waiters(PAGE_PTR pgptr)
int heap_init_func_pred_unpack_info(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, const OID *class_oid, FUNC_PRED_UNPACK_INFO **func_indx_preds)
int heap_rv_nop(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
HEAP_SCANCACHE * scan_cache
void thread_wakeup(cubthread::entry *thread_p, thread_resume_suspend_status resume_reason)
int heap_scancache_quick_start(HEAP_SCANCACHE *scan_cache)
int db_make_oid(DB_VALUE *value, const OID *oid)
#define VPID_GET_FROM_OID(vpid_ptr, oid_ptr)
#define OR_BOUND_BIT_FLAG
int heap_get_class_supers(THREAD_ENTRY *thread_p, const OID *class_oid, OID **super_oids, int *count)
struct heap_hdr_stats HEAP_HDR_STATS
#define MVCC_SET_FLAG(header, flag)
int oid_is_system_class(const OID *class_oid, bool *is_system_class_p)
LC_COPYAREA_MANYOBJS * mobjs
enum mvcc_satisfies_snapshot_result MVCC_SATISFIES_SNAPSHOT_RESULT
#define OR_PUT_BIGINT(ptr, val)
XML_ParsingStatus * status
#define HEAP_DEBUG_SCANCACHE_INITPATTERN
FILE_OVF_HEAP_DES heap_overflow
SCAN_CODE heap_next(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *next_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking)
int heap_indexinfo_get_num_attrs(int btid_index, HEAP_CACHE_ATTRINFO *attrinfo)
#define TP_DOMAIN_CODESET(dom)
pthread_mutex_t LRU_mutex
union or_attribute::@25 auto_increment
INT16 spage_get_record_type(PAGE_PTR page_p, PGSLOTID slot_id)
int heap_header_capacity_end_scan(THREAD_ENTRY *thread_p, void **ptr)
int heap_get_indexinfo_of_btid(THREAD_ENTRY *thread_p, const OID *class_oid, const BTID *btid, BTREE_TYPE *type, int *num_attrs, ATTR_ID **attr_ids, int **attrs_prefix_length, char **btnamepp, int *func_index_col_id)
#define pthread_mutex_lock(a)
enum update_inplace_style UPDATE_INPLACE_STYLE
char * oid_to_string(char *buf, int buf_size, OID *oid)
int heap_attrinfo_set(const OID *inst_oid, ATTR_ID attrid, DB_VALUE *attr_val, HEAP_CACHE_ATTRINFO *attr_info)
int heap_rv_undo_delete(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
OR_ATTRIBUTE * attributes
THREAD_ENTRY * next_wait_thrd
void heap_clear_partition_info(THREAD_ENTRY *thread_p, OR_PARTITION *parts, int parts_count)
int or_pad(OR_BUF *buf, int length)
#define pgbuf_ordered_unfix(thread_p, watcher_object)
char * vfid_to_string(char *buf, int buf_size, VFID *vfid)
#define MVCC_CLEAR_ALL_FLAG_BITS(rec_header_p)
PGBUF_LATCH_MODE latch_mode
#define LSA_LT(lsa_ptr1, lsa_ptr2)
#define HEAP_PERF_TRACK_EXECUTE(thread_p, context)
int heap_rv_mvcc_redo_insert(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int fetch_peek_dbval(THREAD_ENTRY *thread_p, REGU_VARIABLE *regu_var, VAL_DESCR *vd, OID *class_oid, OID *obj_oid, QFILE_TUPLE tpl, DB_VALUE **peek_dbval)
int heap_rv_undoredo_update(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int overflow_get_length(THREAD_ENTRY *thread_p, const VPID *ovf_vpid)
bool heap_is_object_not_null(THREAD_ENTRY *thread_p, OID *class_oid, const OID *oid)
int heap_rv_undo_insert(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int heap_get_class_name(THREAD_ENTRY *thread_p, const OID *class_oid, char **class_name)
#define db_private_realloc(thrd, ptr, size)
#define PR_TYPE_FROM_ID(type)
int overflow_insert(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, VPID *ovf_vpid, RECDES *recdes, FILE_TYPE file_type)
#define pgbuf_ordered_unfix_and_init(thread_p, page, pg_watcher)
#define VPID_SET_NULL(vpid_ptr)
int qdata_increment_dbval(DB_VALUE *dbval_p, DB_VALUE *result_p, int inc_val)
int xheap_reclaim_addresses(THREAD_ENTRY *thread_p, const HFID *hfid)
int heap_rv_undo_ovf_update(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define HEAP_CHNGUESS_FUDGE_MININDICES
SCAN_CODE heap_get_visible_version_internal(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context, bool is_heap_scan)
struct heap_classrepr_lock HEAP_CLASSREPR_LOCK
bool btree_is_unique_type(BTREE_TYPE type)
HEAP_CLASSREPR_FREE_LIST free_list
void stx_free_additional_buff(THREAD_ENTRY *thread_p, void *xasl_unpack_info)
#define PGBUF_PAGE_STATE_ARGS(pg)
HEAP_CLASSREPR_ENTRY * prev
int heap_get_referenced_by(THREAD_ENTRY *thread_p, OID *class_oid, const OID *obj_oid, RECDES *recdes, int *max_oid_cnt, OID **oid_list)
int heap_compact_pages(THREAD_ENTRY *thread_p, OID *class_oid)
#define PGBUF_INIT_WATCHER(w, rank, hfid)
#define HFID_COPY(hfid_ptr1, hfid_ptr2)
#define ER_HEAP_BAD_OBJECT_TYPE
SCAN_CODE log_get_undo_record(THREAD_ENTRY *thread_p, LOG_PAGE *log_page_p, LOG_LSA process_lsa, RECDES *recdes)
#define VACUUM_LOG_ADD_DROPPED_FILE_UNDO
#define VFID_SET_NULL(vfid_ptr)
#define OR_OFFSET_SIZE_1BYTE
void tp_domain_free(TP_DOMAIN *dom)
VPID * pgbuf_get_vpid_ptr(PAGE_PTR pgptr)
PERF_UTIME_TRACKER * time_track
UPDATE_INPLACE_STYLE update_in_place
int or_advance(OR_BUF *buf, int offset)
int heap_insert_hfid_for_class_oid(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid, FILE_TYPE ftype)
#define OR_BUF_INIT2(buf, data, size)
void heap_stats_update(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, const HFID *hfid, int prev_freespace)
#define OR_MVCC_REPID_MASK
#define HEAP_IS_UPDATE_INPLACE(update_inplace_style)
int spage_insert_at(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p)
int heap_set_autoincrement_value(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, HEAP_SCANCACHE *scan_cache, int *is_set)
void heap_free_func_pred_unpack_info(THREAD_ENTRY *thread_p, int n_indexes, FUNC_PRED_UNPACK_INFO *func_indx_preds, int *attr_info_started)
int heap_rv_mvcc_redo_delete_newhome(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define HEAP_STATS_NEXT_BEST_INDEX(i)
#define HEAP_ISVALID_OID(thread_p, oid)
#define ER_MVCC_NOT_SATISFIED_REEVALUATION
HEAP_CLASSREPR_LRU_LIST LRU_list
const VPID * overflow_delete(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, const VPID *ovf_vpid)
SCAN_CODE overflow_get_nbytes(THREAD_ENTRY *thread_p, const VPID *ovf_vpid, RECDES *recdes, int start_offset, int max_nbytes, int *remaining_length, MVCC_SNAPSHOT *mvcc_snapshot)
int spage_insert_for_recovery(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p)
int db_value_domain_init(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale)
SCAN_CODE heap_prev_record_info(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *next_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, DB_VALUE **cache_recordinfo)
#define TP_DOMAIN_COLLATION_FLAG(dom)
SCAN_CODE heap_page_next(THREAD_ENTRY *thread_p, const OID *class_oid, const HFID *hfid, VPID *next_vpid, DB_VALUE **cache_pageinfo)
int file_map_pages(THREAD_ENTRY *thread_p, const VFID *vfid, PGBUF_LATCH_MODE latch_mode, PGBUF_LATCH_CONDITION latch_cond, FILE_MAP_PAGE_FUNC func, void *args)
LF_ENTRY_DESCRIPTOR hfid_hash_descriptor
DB_C_CHAR db_get_string(const DB_VALUE *value)
SCAN_CODE heap_get_class_record(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *recdes_p, HEAP_SCANCACHE *scan_cache, int ispeeking)